[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 5 | #ifndef CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_ |
| 6 | #define CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_ |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "base/compiler_specific.h" |
[email protected] | 5799981 | 2013-02-24 05:40:52 | [diff] [blame] | 11 | #include "base/files/file_path.h" |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 12 | #include "base/memory/scoped_ptr.h" |
[email protected] | 87f3c08 | 2011-10-19 18:07:44 | [diff] [blame] | 13 | #include "content/public/browser/content_browser_client.h" |
[email protected] | 9896c55 | 2013-08-29 19:03:20 | [diff] [blame] | 14 | #include "content/shell/browser/shell_speech_recognition_manager_delegate.h" |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 15 | |
| 16 | namespace content { |
| 17 | |
[email protected] | 147f809 | 2012-03-21 11:47:45 | [diff] [blame] | 18 | class ShellBrowserContext; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 19 | class ShellBrowserMainParts; |
[email protected] | e3503ac | 2012-04-05 15:01:36 | [diff] [blame] | 20 | class ShellResourceDispatcherHostDelegate; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 21 | |
[email protected] | 7f550087 | 2013-11-12 20:03:54 | [diff] [blame] | 22 | class ShellContentBrowserClient : public ContentBrowserClient { |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 23 | public: |
[email protected] | eabbfb1 | 2013-04-05 23:28:35 | [diff] [blame] | 24 | // Gets the current instance. |
| 25 | static ShellContentBrowserClient* Get(); |
| 26 | |
[email protected] | fbaccee | 2013-08-12 23:24:02 | [diff] [blame] | 27 | static void SetSwapProcessesForRedirect(bool swap); |
| 28 | |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 29 | ShellContentBrowserClient(); |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 30 | ~ShellContentBrowserClient() override; |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 31 | |
[email protected] | bdcf915 | 2012-07-19 17:43:21 | [diff] [blame] | 32 | // ContentBrowserClient overrides. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 33 | BrowserMainParts* CreateBrowserMainParts( |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 34 | const MainFunctionParams& parameters) override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 35 | void RenderProcessWillLaunch(RenderProcessHost* host) override; |
| 36 | net::URLRequestContextGetter* CreateRequestContext( |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 37 | BrowserContext* browser_context, |
[email protected] | 7571263c | 2014-03-10 22:57:09 | [diff] [blame] | 38 | ProtocolHandlerMap* protocol_handlers, |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 39 | URLRequestInterceptorScopedVector request_interceptors) override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 40 | net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 41 | BrowserContext* browser_context, |
[email protected] | c42de73 | 2013-02-16 06:26:31 | [diff] [blame] | 42 | const base::FilePath& partition_path, |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 43 | bool in_memory, |
[email protected] | 7571263c | 2014-03-10 22:57:09 | [diff] [blame] | 44 | ProtocolHandlerMap* protocol_handlers, |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 45 | URLRequestInterceptorScopedVector request_interceptors) override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 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 | const GURL& url, |
| 51 | WebPreferences* prefs) override; |
| 52 | void ResourceDispatcherHostCreated() override; |
| 53 | AccessTokenStore* CreateAccessTokenStore() override; |
| 54 | std::string GetDefaultDownloadName() override; |
| 55 | WebContentsViewDelegate* GetWebContentsViewDelegate( |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 56 | WebContents* web_contents) override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 57 | QuotaPermissionContext* CreateQuotaPermissionContext() override; |
zork | b548de08 | 2014-11-14 21:40:47 | [diff] [blame] | 58 | SpeechRecognitionManagerDelegate* CreateSpeechRecognitionManagerDelegate() |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 59 | override; |
| 60 | net::NetLog* GetNetLog() override; |
| 61 | bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context, |
| 62 | const GURL& current_url, |
| 63 | const GURL& new_url) override; |
| 64 | DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 65 | |
mlamouri | eb40d55 | 2015-02-05 00:57:08 | [diff] [blame^] | 66 | WebContents* OpenURL(BrowserContext* browser_context, |
| 67 | const OpenURLParams& params) override; |
| 68 | |
[email protected] | a7aa8ab | 2013-10-24 07:21:48 | [diff] [blame] | 69 | #if defined(OS_POSIX) && !defined(OS_MACOSX) |
dcheng | f576215 | 2014-10-29 02:12:06 | [diff] [blame] | 70 | void GetAdditionalMappedFilesForChildProcess( |
[email protected] | 2f3b1cc | 2014-03-17 23:07:15 | [diff] [blame] | 71 | const base::CommandLine& command_line, |
[email protected] | 12c779c | 2012-10-25 09:39:57 | [diff] [blame] | 72 | int child_process_id, |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 73 | FileDescriptorInfo* mappings) override; |
[email protected] | f83a4739 | 2012-07-12 22:15:04 | [diff] [blame] | 74 | #endif |
[email protected] | a553b67 | 2014-04-16 05:40:41 | [diff] [blame] | 75 | #if defined(OS_WIN) |
| 76 | virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy, |
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 77 | bool* success) override; |
[email protected] | a553b67 | 2014-04-16 05:40:41 | [diff] [blame] | 78 | #endif |
[email protected] | f83a4739 | 2012-07-12 22:15:04 | [diff] [blame] | 79 | |
[email protected] | 147f809 | 2012-03-21 11:47:45 | [diff] [blame] | 80 | ShellBrowserContext* browser_context(); |
[email protected] | 71d504f | 2012-07-25 17:15:28 | [diff] [blame] | 81 | ShellBrowserContext* off_the_record_browser_context(); |
| 82 | ShellResourceDispatcherHostDelegate* resource_dispatcher_host_delegate() { |
| 83 | return resource_dispatcher_host_delegate_.get(); |
| 84 | } |
[email protected] | 7c17b69 | 2012-08-09 16:16:30 | [diff] [blame] | 85 | ShellBrowserMainParts* shell_browser_main_parts() { |
| 86 | return shell_browser_main_parts_; |
| 87 | } |
[email protected] | 147f809 | 2012-03-21 11:47:45 | [diff] [blame] | 88 | |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 89 | private: |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 90 | ShellBrowserContext* ShellBrowserContextForBrowserContext( |
| 91 | BrowserContext* content_browser_context); |
| 92 | |
[email protected] | e3503ac | 2012-04-05 15:01:36 | [diff] [blame] | 93 | scoped_ptr<ShellResourceDispatcherHostDelegate> |
| 94 | resource_dispatcher_host_delegate_; |
| 95 | |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 96 | ShellBrowserMainParts* shell_browser_main_parts_; |
[email protected] | 5629e0c | 2011-09-12 22:07:36 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | } // namespace content |
| 100 | |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 101 | #endif // CONTENT_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_ |