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
) OVERRIDE
;
40 virtual net::URLRequestContextGetter
* CreateRequestContextForStoragePartition(
41 BrowserContext
* browser_context
,
42 const base::FilePath
& partition_path
,
44 ProtocolHandlerMap
* protocol_handlers
) OVERRIDE
;
45 virtual bool IsHandledURL(const GURL
& url
) OVERRIDE
;
46 virtual void AppendExtraCommandLineSwitches(CommandLine
* command_line
,
47 int child_process_id
) OVERRIDE
;
48 virtual void OverrideWebkitPrefs(RenderViewHost
* render_view_host
,
50 WebPreferences
* prefs
) OVERRIDE
;
51 virtual void ResourceDispatcherHostCreated() OVERRIDE
;
52 virtual AccessTokenStore
* CreateAccessTokenStore() OVERRIDE
;
53 virtual std::string
GetDefaultDownloadName() OVERRIDE
;
54 virtual bool SupportsBrowserPlugin(content::BrowserContext
* browser_context
,
55 const GURL
& url
) OVERRIDE
;
56 virtual WebContentsViewDelegate
* GetWebContentsViewDelegate(
57 WebContents
* web_contents
) OVERRIDE
;
58 virtual QuotaPermissionContext
* CreateQuotaPermissionContext() OVERRIDE
;
59 virtual SpeechRecognitionManagerDelegate
*
60 GetSpeechRecognitionManagerDelegate() OVERRIDE
;
61 virtual net::NetLog
* GetNetLog() OVERRIDE
;
62 virtual bool ShouldSwapProcessesForRedirect(ResourceContext
* resource_context
,
63 const GURL
& current_url
,
64 const GURL
& new_url
) OVERRIDE
;
66 #if defined(OS_POSIX) && !defined(OS_MACOSX)
67 virtual void GetAdditionalMappedFilesForChildProcess(
68 const CommandLine
& command_line
,
70 std::vector
<content::FileDescriptorInfo
>* mappings
) OVERRIDE
;
73 ShellBrowserContext
* browser_context();
74 ShellBrowserContext
* off_the_record_browser_context();
75 ShellResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate() {
76 return resource_dispatcher_host_delegate_
.get();
78 ShellBrowserMainParts
* shell_browser_main_parts() {
79 return shell_browser_main_parts_
;
83 ShellBrowserContext
* ShellBrowserContextForBrowserContext(
84 BrowserContext
* content_browser_context
);
86 scoped_ptr
<ShellResourceDispatcherHostDelegate
>
87 resource_dispatcher_host_delegate_
;
89 base::FilePath webkit_source_dir_
;
91 ShellBrowserMainParts
* shell_browser_main_parts_
;
94 } // namespace content
96 #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_