OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/shell_content_browser_client.h" | 5 #include "content/shell/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
11 #include "content/public/browser/resource_dispatcher_host.h" | 11 #include "content/public/browser/resource_dispatcher_host.h" |
| 12 #include "content/public/common/url_constants.h" |
12 #include "content/shell/geolocation/shell_access_token_store.h" | 13 #include "content/shell/geolocation/shell_access_token_store.h" |
13 #include "content/shell/shell.h" | 14 #include "content/shell/shell.h" |
14 #include "content/shell/shell_browser_context.h" | 15 #include "content/shell/shell_browser_context.h" |
15 #include "content/shell/shell_browser_main_parts.h" | 16 #include "content/shell/shell_browser_main_parts.h" |
16 #include "content/shell/shell_devtools_delegate.h" | 17 #include "content/shell/shell_devtools_delegate.h" |
17 #include "content/shell/shell_message_filter.h" | 18 #include "content/shell/shell_message_filter.h" |
18 #include "content/shell/shell_messages.h" | 19 #include "content/shell/shell_messages.h" |
19 #include "content/shell/shell_resource_dispatcher_host_delegate.h" | 20 #include "content/shell/shell_resource_dispatcher_host_delegate.h" |
20 #include "content/shell/shell_switches.h" | 21 #include "content/shell/shell_switches.h" |
21 #include "content/shell/shell_web_contents_view_delegate_creator.h" | 22 #include "content/shell/shell_web_contents_view_delegate_creator.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 chrome_devtools_protocol_handler) { | 119 chrome_devtools_protocol_handler) { |
119 ShellBrowserContext* shell_browser_context = | 120 ShellBrowserContext* shell_browser_context = |
120 ShellBrowserContextForBrowserContext(content_browser_context); | 121 ShellBrowserContextForBrowserContext(content_browser_context); |
121 return shell_browser_context->CreateRequestContextForStoragePartition( | 122 return shell_browser_context->CreateRequestContextForStoragePartition( |
122 partition_path, in_memory, blob_protocol_handler.Pass(), | 123 partition_path, in_memory, blob_protocol_handler.Pass(), |
123 file_system_protocol_handler.Pass(), | 124 file_system_protocol_handler.Pass(), |
124 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), | 125 developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), |
125 chrome_devtools_protocol_handler.Pass()); | 126 chrome_devtools_protocol_handler.Pass()); |
126 } | 127 } |
127 | 128 |
| 129 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 130 if (!url.is_valid()) |
| 131 return false; |
| 132 DCHECK_EQ(url.scheme(), StringToLowerASCII(url.scheme())); |
| 133 // Keep in sync with ProtocolHandlers added by |
| 134 // ShellURLRequestContextGetter::GetURLRequestContext(). |
| 135 static const char* const kProtocolList[] = { |
| 136 chrome::kBlobScheme, |
| 137 chrome::kFileSystemScheme, |
| 138 chrome::kChromeUIScheme, |
| 139 chrome::kChromeDevToolsScheme, |
| 140 chrome::kDataScheme, |
| 141 chrome::kFileScheme, |
| 142 }; |
| 143 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
| 144 if (url.scheme() == kProtocolList[i]) |
| 145 return true; |
| 146 } |
| 147 return false; |
| 148 } |
| 149 |
128 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 150 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
129 CommandLine* command_line, int child_process_id) { | 151 CommandLine* command_line, int child_process_id) { |
130 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 152 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
131 command_line->AppendSwitch(switches::kDumpRenderTree); | 153 command_line->AppendSwitch(switches::kDumpRenderTree); |
132 } | 154 } |
133 | 155 |
134 void ShellContentBrowserClient::OverrideWebkitPrefs( | 156 void ShellContentBrowserClient::OverrideWebkitPrefs( |
135 RenderViewHost* render_view_host, | 157 RenderViewHost* render_view_host, |
136 const GURL& url, | 158 const GURL& url, |
137 webkit_glue::WebPreferences* prefs) { | 159 webkit_glue::WebPreferences* prefs) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 ShellBrowserContext* | 222 ShellBrowserContext* |
201 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 223 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
202 BrowserContext* content_browser_context) { | 224 BrowserContext* content_browser_context) { |
203 if (content_browser_context == browser_context()) | 225 if (content_browser_context == browser_context()) |
204 return browser_context(); | 226 return browser_context(); |
205 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 227 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
206 return off_the_record_browser_context(); | 228 return off_the_record_browser_context(); |
207 } | 229 } |
208 | 230 |
209 } // namespace content | 231 } // namespace content |
OLD | NEW |