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 "base/platform_file.h"
14 #include "content/public/browser/content_browser_client.h"
15 #include "content/shell/browser/shell_speech_recognition_manager_delegate.h"
19 class ShellBrowserContext
;
20 class ShellBrowserMainParts
;
21 class ShellResourceDispatcherHostDelegate
;
23 class ShellContentBrowserClient
: public ContentBrowserClient
{
25 // Gets the current instance.
26 static ShellContentBrowserClient
* Get();
28 static void SetSwapProcessesForRedirect(bool swap
);
30 ShellContentBrowserClient();
31 virtual ~ShellContentBrowserClient();
33 // ContentBrowserClient overrides.
34 virtual BrowserMainParts
* CreateBrowserMainParts(
35 const MainFunctionParams
& parameters
) OVERRIDE
;
36 virtual void RenderProcessWillLaunch(RenderProcessHost
* host
) OVERRIDE
;
37 virtual net::URLRequestContextGetter
* CreateRequestContext(
38 BrowserContext
* browser_context
,
39 ProtocolHandlerMap
* protocol_handlers
,
40 ProtocolHandlerScopedVector protocol_interceptors
) OVERRIDE
;
41 virtual net::URLRequestContextGetter
* CreateRequestContextForStoragePartition(
42 BrowserContext
* browser_context
,
43 const base::FilePath
& partition_path
,
45 ProtocolHandlerMap
* protocol_handlers
,
46 ProtocolHandlerScopedVector protocol_interceptors
) OVERRIDE
;
47 virtual bool IsHandledURL(const GURL
& url
) OVERRIDE
;
48 virtual void AppendExtraCommandLineSwitches(base::CommandLine
* command_line
,
49 int child_process_id
) OVERRIDE
;
50 virtual void OverrideWebkitPrefs(RenderViewHost
* render_view_host
,
52 WebPreferences
* prefs
) OVERRIDE
;
53 virtual void ResourceDispatcherHostCreated() OVERRIDE
;
54 virtual AccessTokenStore
* CreateAccessTokenStore() OVERRIDE
;
55 virtual std::string
GetDefaultDownloadName() OVERRIDE
;
56 virtual bool SupportsBrowserPlugin(content::BrowserContext
* browser_context
,
57 const GURL
& url
) OVERRIDE
;
58 virtual WebContentsViewDelegate
* GetWebContentsViewDelegate(
59 WebContents
* web_contents
) OVERRIDE
;
60 virtual QuotaPermissionContext
* CreateQuotaPermissionContext() OVERRIDE
;
61 virtual SpeechRecognitionManagerDelegate
*
62 GetSpeechRecognitionManagerDelegate() OVERRIDE
;
63 virtual net::NetLog
* GetNetLog() OVERRIDE
;
64 virtual bool ShouldSwapProcessesForRedirect(ResourceContext
* resource_context
,
65 const GURL
& current_url
,
66 const GURL
& new_url
) OVERRIDE
;
68 #if defined(OS_POSIX) && !defined(OS_MACOSX)
69 virtual void GetAdditionalMappedFilesForChildProcess(
70 const base::CommandLine
& command_line
,
72 std::vector
<content::FileDescriptorInfo
>* mappings
) OVERRIDE
;
75 ShellBrowserContext
* browser_context();
76 ShellBrowserContext
* off_the_record_browser_context();
77 ShellResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate() {
78 return resource_dispatcher_host_delegate_
.get();
80 ShellBrowserMainParts
* shell_browser_main_parts() {
81 return shell_browser_main_parts_
;
85 ShellBrowserContext
* ShellBrowserContextForBrowserContext(
86 BrowserContext
* content_browser_context
);
88 scoped_ptr
<ShellResourceDispatcherHostDelegate
>
89 resource_dispatcher_host_delegate_
;
91 base::FilePath webkit_source_dir_
;
93 ShellBrowserMainParts
* shell_browser_main_parts_
;
96 } // namespace content
98 #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_