| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "extensions/shell/browser/shell_content_browser_client.h" | 5 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 content::URLRequestInterceptorScopedVector request_interceptors) { | 106 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 107 // Handle only chrome-extension:// requests. app_shell does not support | 107 // Handle only chrome-extension:// requests. app_shell does not support |
| 108 // chrome-extension-resource:// requests (it does not store shared extension | 108 // chrome-extension-resource:// requests (it does not store shared extension |
| 109 // data in its installation directory). | 109 // data in its installation directory). |
| 110 InfoMap* extension_info_map = | 110 InfoMap* extension_info_map = |
| 111 browser_main_parts_->extension_system()->info_map(); | 111 browser_main_parts_->extension_system()->info_map(); |
| 112 (*protocol_handlers)[kExtensionScheme] = | 112 (*protocol_handlers)[kExtensionScheme] = |
| 113 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 113 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
| 114 CreateExtensionProtocolHandler(false /* is_incognito */, | 114 CreateExtensionProtocolHandler(false /* is_incognito */, |
| 115 extension_info_map)); | 115 extension_info_map)); |
| 116 // Let content::ShellBrowserContext handle the rest of the setup. | |
| 117 return browser_main_parts_->browser_context()->CreateRequestContext( | 116 return browser_main_parts_->browser_context()->CreateRequestContext( |
| 118 protocol_handlers, request_interceptors.Pass()); | 117 protocol_handlers, request_interceptors.Pass(), extension_info_map); |
| 119 } | 118 } |
| 120 | 119 |
| 121 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 120 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 122 if (!url.is_valid()) | 121 if (!url.is_valid()) |
| 123 return false; | 122 return false; |
| 124 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in | 123 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in |
| 125 // content::ShellURLRequestContextGetter::GetURLRequestContext(). | 124 // content::ShellURLRequestContextGetter::GetURLRequestContext(). |
| 126 static const char* const kProtocolList[] = { | 125 static const char* const kProtocolList[] = { |
| 127 url::kBlobScheme, | 126 url::kBlobScheme, |
| 128 content::kChromeDevToolsScheme, | 127 content::kChromeDevToolsScheme, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 return registry->enabled_extensions().GetExtensionOrAppByURL( | 243 return registry->enabled_extensions().GetExtensionOrAppByURL( |
| 245 site_instance->GetSiteURL()); | 244 site_instance->GetSiteURL()); |
| 246 } | 245 } |
| 247 | 246 |
| 248 content::DevToolsManagerDelegate* | 247 content::DevToolsManagerDelegate* |
| 249 ShellContentBrowserClient::GetDevToolsManagerDelegate() { | 248 ShellContentBrowserClient::GetDevToolsManagerDelegate() { |
| 250 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); | 249 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace extensions | 252 } // namespace extensions |
| OLD | NEW |