1 // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/content_browser_client.h"
21 namespace extensions
{
23 class ShellBrowserMainDelegate
;
24 class ShellBrowserMainParts
;
26 // Content module browser process support for app_shell.
27 class ShellContentBrowserClient
: public content::ContentBrowserClient
{
29 explicit ShellContentBrowserClient(
30 ShellBrowserMainDelegate
* browser_main_delegate
);
31 ~ShellContentBrowserClient() override
;
33 // Returns the single instance.
34 static ShellContentBrowserClient
* Get();
36 // Returns the single browser context for app_shell.
37 content::BrowserContext
* GetBrowserContext();
39 // content::ContentBrowserClient overrides.
40 content::BrowserMainParts
* CreateBrowserMainParts(
41 const content::MainFunctionParams
& parameters
) override
;
42 void RenderProcessWillLaunch(content::RenderProcessHost
* host
) override
;
43 bool ShouldUseProcessPerSite(content::BrowserContext
* browser_context
,
44 const GURL
& effective_url
) override
;
45 net::URLRequestContextGetter
* CreateRequestContext(
46 content::BrowserContext
* browser_context
,
47 content::ProtocolHandlerMap
* protocol_handlers
,
48 content::URLRequestInterceptorScopedVector request_interceptors
) override
;
49 // TODO(jamescook): Quota management?
50 bool IsHandledURL(const GURL
& url
) override
;
51 void SiteInstanceGotProcess(content::SiteInstance
* site_instance
) override
;
52 void SiteInstanceDeleting(content::SiteInstance
* site_instance
) override
;
53 void AppendExtraCommandLineSwitches(base::CommandLine
* command_line
,
54 int child_process_id
) override
;
55 content::SpeechRecognitionManagerDelegate
*
56 CreateSpeechRecognitionManagerDelegate() override
;
57 content::BrowserPpapiHost
* GetExternalBrowserPpapiHost(
58 int plugin_process_id
) override
;
59 void GetAdditionalAllowedSchemesForFileSystem(
60 std::vector
<std::string
>* additional_schemes
) override
;
61 #if defined(OS_POSIX) && !defined(OS_MACOSX)
62 void GetAdditionalMappedFilesForChildProcess(
63 const base::CommandLine
& command_line
,
65 content::FileDescriptorInfo
* mappings
) override
;
68 content::DevToolsManagerDelegate
* GetDevToolsManagerDelegate() override
;
71 // Subclasses may wish to provide their own ShellBrowserMainParts.
72 virtual ShellBrowserMainParts
* CreateShellBrowserMainParts(
73 const content::MainFunctionParams
& parameters
,
74 ShellBrowserMainDelegate
* browser_main_delegate
);
77 // Appends command line switches for a renderer process.
78 void AppendRendererSwitches(base::CommandLine
* command_line
);
80 // Returns the extension or app associated with |site_instance| or NULL.
81 const Extension
* GetExtension(content::SiteInstance
* site_instance
);
83 #if defined(OS_POSIX) && !defined(OS_MACOSX)
84 base::ScopedFD v8_natives_fd_
;
85 base::ScopedFD v8_snapshot_fd_
;
88 // Owned by content::BrowserMainLoop.
89 ShellBrowserMainParts
* browser_main_parts_
;
91 // Owned by ShellBrowserMainParts.
92 ShellBrowserMainDelegate
* browser_main_delegate_
;
94 DISALLOW_COPY_AND_ASSIGN(ShellContentBrowserClient
);
97 } // namespace extensions
99 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_