| 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 "components/guest_view/browser/guest_view_message_filter.h" | 8 #include "components/guest_view/browser/guest_view_message_filter.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 content::ProtocolHandlerMap* protocol_handlers, | 116 content::ProtocolHandlerMap* protocol_handlers, |
| 117 content::URLRequestInterceptorScopedVector request_interceptors) { | 117 content::URLRequestInterceptorScopedVector request_interceptors) { |
| 118 // Handle only chrome-extension:// requests. app_shell does not support | 118 // Handle only chrome-extension:// requests. app_shell does not support |
| 119 // chrome-extension-resource:// requests (it does not store shared extension | 119 // chrome-extension-resource:// requests (it does not store shared extension |
| 120 // data in its installation directory). | 120 // data in its installation directory). |
| 121 InfoMap* extension_info_map = | 121 InfoMap* extension_info_map = |
| 122 browser_main_parts_->extension_system()->info_map(); | 122 browser_main_parts_->extension_system()->info_map(); |
| 123 (*protocol_handlers)[kExtensionScheme] = | 123 (*protocol_handlers)[kExtensionScheme] = |
| 124 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 124 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
| 125 CreateExtensionProtocolHandler(false /* is_incognito */, | 125 CreateExtensionProtocolHandler(false /* is_incognito */, |
| 126 extension_info_map)); | 126 extension_info_map) |
| 127 .release()); |
| 127 return browser_main_parts_->browser_context()->CreateRequestContext( | 128 return browser_main_parts_->browser_context()->CreateRequestContext( |
| 128 protocol_handlers, request_interceptors.Pass(), extension_info_map); | 129 protocol_handlers, request_interceptors.Pass(), extension_info_map); |
| 129 } | 130 } |
| 130 | 131 |
| 131 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 132 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 132 if (!url.is_valid()) | 133 if (!url.is_valid()) |
| 133 return false; | 134 return false; |
| 134 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in | 135 // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in |
| 135 // content::ShellURLRequestContextGetter::GetURLRequestContext(). | 136 // content::ShellURLRequestContextGetter::GetURLRequestContext(). |
| 136 static const char* const kProtocolList[] = { | 137 static const char* const kProtocolList[] = { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 265 |
| 265 const Extension* ShellContentBrowserClient::GetExtension( | 266 const Extension* ShellContentBrowserClient::GetExtension( |
| 266 content::SiteInstance* site_instance) { | 267 content::SiteInstance* site_instance) { |
| 267 ExtensionRegistry* registry = | 268 ExtensionRegistry* registry = |
| 268 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 269 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
| 269 return registry->enabled_extensions().GetExtensionOrAppByURL( | 270 return registry->enabled_extensions().GetExtensionOrAppByURL( |
| 270 site_instance->GetSiteURL()); | 271 site_instance->GetSiteURL()); |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |