1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/public/browser/content_browser_client.h"
14 #include "content/shell/browser/shell_speech_recognition_manager_delegate.h"
18 class ShellBrowserContext
;
19 class ShellBrowserMainParts
;
20 class ShellResourceDispatcherHostDelegate
;
22 class ShellContentBrowserClient
: public ContentBrowserClient
{
24 // Gets the current instance.
25 static ShellContentBrowserClient
* Get();
27 static void SetSwapProcessesForRedirect(bool swap
);
29 ShellContentBrowserClient();
30 ~ShellContentBrowserClient() override
;
32 // ContentBrowserClient overrides.
33 BrowserMainParts
* CreateBrowserMainParts(
34 const MainFunctionParams
& parameters
) override
;
35 void RenderProcessWillLaunch(RenderProcessHost
* host
) override
;
36 net::URLRequestContextGetter
* CreateRequestContext(
37 BrowserContext
* browser_context
,
38 ProtocolHandlerMap
* protocol_handlers
,
39 URLRequestInterceptorScopedVector request_interceptors
) override
;
40 net::URLRequestContextGetter
* CreateRequestContextForStoragePartition(
41 BrowserContext
* browser_context
,
42 const base::FilePath
& partition_path
,
44 ProtocolHandlerMap
* protocol_handlers
,
45 URLRequestInterceptorScopedVector request_interceptors
) override
;
46 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 WebPreferences
* prefs
) override
;
51 void ResourceDispatcherHostCreated() override
;
52 AccessTokenStore
* CreateAccessTokenStore() override
;
53 std::string
GetDefaultDownloadName() override
;
54 WebContentsViewDelegate
* GetWebContentsViewDelegate(
55 WebContents
* web_contents
) override
;
56 QuotaPermissionContext
* CreateQuotaPermissionContext() override
;
57 void SelectClientCertificate(
58 WebContents
* web_contents
,
59 net::SSLCertRequestInfo
* cert_request_info
,
60 scoped_ptr
<ClientCertificateDelegate
> delegate
) override
;
62 SpeechRecognitionManagerDelegate
* CreateSpeechRecognitionManagerDelegate()
64 net::NetLog
* GetNetLog() override
;
65 bool ShouldSwapProcessesForRedirect(ResourceContext
* resource_context
,
66 const GURL
& current_url
,
67 const GURL
& new_url
) override
;
68 DevToolsManagerDelegate
* GetDevToolsManagerDelegate() override
;
70 void OpenURL(BrowserContext
* browser_context
,
71 const OpenURLParams
& params
,
72 const base::Callback
<void(WebContents
*)>& callback
) override
;
74 #if defined(OS_POSIX) && !defined(OS_MACOSX)
75 void GetAdditionalMappedFilesForChildProcess(
76 const base::CommandLine
& command_line
,
78 FileDescriptorInfo
* mappings
) override
;
81 void PreSpawnRenderer(sandbox::TargetPolicy
* policy
, bool* success
) override
;
84 ShellBrowserContext
* browser_context();
85 ShellBrowserContext
* off_the_record_browser_context();
86 ShellResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate() {
87 return resource_dispatcher_host_delegate_
.get();
89 ShellBrowserMainParts
* shell_browser_main_parts() {
90 return shell_browser_main_parts_
;
93 // Used for content_browsertests.
94 void set_select_client_certificate_callback(
95 base::Closure select_client_certificate_callback
) {
96 select_client_certificate_callback_
= select_client_certificate_callback
;
100 ShellBrowserContext
* ShellBrowserContextForBrowserContext(
101 BrowserContext
* content_browser_context
);
103 scoped_ptr
<ShellResourceDispatcherHostDelegate
>
104 resource_dispatcher_host_delegate_
;
106 base::Closure select_client_certificate_callback_
;
108 ShellBrowserMainParts
* shell_browser_main_parts_
;
111 } // namespace content
113 #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_