blob: a2d8a97928f033ef0217d7e2781e4d2377e07d82 [file] [log] [blame]
[email protected]de7d61ff2013-08-20 11:30:411// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]5629e0c2011-09-12 22:07:362// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]de7d61ff2013-08-20 11:30:415#ifndef CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
6#define CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
[email protected]5629e0c2011-09-12 22:07:367
8#include <string>
9
10#include "base/compiler_specific.h"
[email protected]57999812013-02-24 05:40:5211#include "base/files/file_path.h"
[email protected]b0f146f2011-09-15 22:14:2512#include "base/memory/scoped_ptr.h"
[email protected]87f3c082011-10-19 18:07:4413#include "content/public/browser/content_browser_client.h"
[email protected]9896c552013-08-29 19:03:2014#include "content/shell/browser/shell_speech_recognition_manager_delegate.h"
[email protected]5629e0c2011-09-12 22:07:3615
16namespace content {
17
[email protected]147f8092012-03-21 11:47:4518class ShellBrowserContext;
[email protected]b0f146f2011-09-15 22:14:2519class ShellBrowserMainParts;
[email protected]e3503ac2012-04-05 15:01:3620class ShellResourceDispatcherHostDelegate;
[email protected]b0f146f2011-09-15 22:14:2521
[email protected]7f5500872013-11-12 20:03:5422class ShellContentBrowserClient : public ContentBrowserClient {
[email protected]5629e0c2011-09-12 22:07:3623 public:
[email protected]eabbfb12013-04-05 23:28:3524 // Gets the current instance.
25 static ShellContentBrowserClient* Get();
26
[email protected]fbaccee2013-08-12 23:24:0227 static void SetSwapProcessesForRedirect(bool swap);
28
[email protected]b0f146f2011-09-15 22:14:2529 ShellContentBrowserClient();
dchenge933b3e2014-10-21 11:44:0930 ~ShellContentBrowserClient() override;
[email protected]5629e0c2011-09-12 22:07:3631
[email protected]bdcf9152012-07-19 17:43:2132 // ContentBrowserClient overrides.
dchenge933b3e2014-10-21 11:44:0933 BrowserMainParts* CreateBrowserMainParts(
anand.ratn449f39a42014-10-06 13:45:5734 const MainFunctionParams& parameters) override;
dchenge933b3e2014-10-21 11:44:0935 void RenderProcessWillLaunch(RenderProcessHost* host) override;
36 net::URLRequestContextGetter* CreateRequestContext(
[email protected]6bd30072013-02-08 18:17:1137 BrowserContext* browser_context,
[email protected]7571263c2014-03-10 22:57:0938 ProtocolHandlerMap* protocol_handlers,
anand.ratn449f39a42014-10-06 13:45:5739 URLRequestInterceptorScopedVector request_interceptors) override;
dchenge933b3e2014-10-21 11:44:0940 net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
[email protected]6bd30072013-02-08 18:17:1141 BrowserContext* browser_context,
[email protected]c42de732013-02-16 06:26:3142 const base::FilePath& partition_path,
[email protected]6bd30072013-02-08 18:17:1143 bool in_memory,
[email protected]7571263c2014-03-10 22:57:0944 ProtocolHandlerMap* protocol_handlers,
anand.ratn449f39a42014-10-06 13:45:5745 URLRequestInterceptorScopedVector request_interceptors) override;
dchenge933b3e2014-10-21 11:44:0946 bool IsHandledURL(const GURL& url) override;
47 void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
48 int child_process_id) override;
49 void OverrideWebkitPrefs(RenderViewHost* render_view_host,
50 const GURL& url,
51 WebPreferences* prefs) override;
52 void ResourceDispatcherHostCreated() override;
53 AccessTokenStore* CreateAccessTokenStore() override;
54 std::string GetDefaultDownloadName() override;
55 WebContentsViewDelegate* GetWebContentsViewDelegate(
anand.ratn449f39a42014-10-06 13:45:5756 WebContents* web_contents) override;
dchenge933b3e2014-10-21 11:44:0957 QuotaPermissionContext* CreateQuotaPermissionContext() override;
zorkb548de082014-11-14 21:40:4758 SpeechRecognitionManagerDelegate* CreateSpeechRecognitionManagerDelegate()
dchenge933b3e2014-10-21 11:44:0959 override;
60 net::NetLog* GetNetLog() override;
61 bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context,
62 const GURL& current_url,
63 const GURL& new_url) override;
64 DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
[email protected]b0f146f2011-09-15 22:14:2565
mlamourieb40d552015-02-05 00:57:0866 WebContents* OpenURL(BrowserContext* browser_context,
67 const OpenURLParams& params) override;
68
[email protected]a7aa8ab2013-10-24 07:21:4869#if defined(OS_POSIX) && !defined(OS_MACOSX)
dchengf5762152014-10-29 02:12:0670 void GetAdditionalMappedFilesForChildProcess(
[email protected]2f3b1cc2014-03-17 23:07:1571 const base::CommandLine& command_line,
[email protected]12c779c2012-10-25 09:39:5772 int child_process_id,
anand.ratn449f39a42014-10-06 13:45:5773 FileDescriptorInfo* mappings) override;
[email protected]f83a47392012-07-12 22:15:0474#endif
[email protected]a553b672014-04-16 05:40:4175#if defined(OS_WIN)
76 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy,
anand.ratn449f39a42014-10-06 13:45:5777 bool* success) override;
[email protected]a553b672014-04-16 05:40:4178#endif
[email protected]f83a47392012-07-12 22:15:0479
[email protected]147f8092012-03-21 11:47:4580 ShellBrowserContext* browser_context();
[email protected]71d504f2012-07-25 17:15:2881 ShellBrowserContext* off_the_record_browser_context();
82 ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() {
83 return resource_dispatcher_host_delegate_.get();
84 }
[email protected]7c17b692012-08-09 16:16:3085 ShellBrowserMainParts* shell_browser_main_parts() {
86 return shell_browser_main_parts_;
87 }
[email protected]147f8092012-03-21 11:47:4588
[email protected]b0f146f2011-09-15 22:14:2589 private:
[email protected]6bd30072013-02-08 18:17:1190 ShellBrowserContext* ShellBrowserContextForBrowserContext(
91 BrowserContext* content_browser_context);
92
[email protected]e3503ac2012-04-05 15:01:3693 scoped_ptr<ShellResourceDispatcherHostDelegate>
94 resource_dispatcher_host_delegate_;
95
[email protected]b0f146f2011-09-15 22:14:2596 ShellBrowserMainParts* shell_browser_main_parts_;
[email protected]5629e0c2011-09-12 22:07:3697};
98
99} // namespace content
100
[email protected]de7d61ff2013-08-20 11:30:41101#endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_