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 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 base::CommandLine
& command_line
,
70 std::vector
<content::FileDescriptorInfo
>* mappings
) OVERRIDE
;
73 virtual void PreSpawnRenderer(sandbox::TargetPolicy
* policy
,
74 bool* success
) OVERRIDE
;
77 ShellBrowserContext
* browser_context();
78 ShellBrowserContext
* off_the_record_browser_context();
79 ShellResourceDispatcherHostDelegate
* resource_dispatcher_host_delegate() {
80 return resource_dispatcher_host_delegate_
.get();
82 ShellBrowserMainParts
* shell_browser_main_parts() {
83 return shell_browser_main_parts_
;
87 ShellBrowserContext
* ShellBrowserContextForBrowserContext(
88 BrowserContext
* content_browser_context
);
90 scoped_ptr
<ShellResourceDispatcherHostDelegate
>
91 resource_dispatcher_host_delegate_
;
93 base::FilePath webkit_source_dir_
;
95 ShellBrowserMainParts
* shell_browser_main_parts_
;
98 } // namespace content
100 #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_