| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // ShellBrowserContext::CreateRequestContext() and in | 127 // ShellBrowserContext::CreateRequestContext() and in |
| 128 // content::ShellURLRequestContextGetter::GetURLRequestContext(). | 128 // content::ShellURLRequestContextGetter::GetURLRequestContext(). |
| 129 static const char* const kProtocolList[] = { | 129 static const char* const kProtocolList[] = { |
| 130 url::kBlobScheme, | 130 url::kBlobScheme, |
| 131 content::kChromeDevToolsScheme, | 131 content::kChromeDevToolsScheme, |
| 132 content::kChromeUIScheme, | 132 content::kChromeUIScheme, |
| 133 url::kDataScheme, | 133 url::kDataScheme, |
| 134 url::kFileScheme, | 134 url::kFileScheme, |
| 135 url::kFileSystemScheme, | 135 url::kFileSystemScheme, |
| 136 kExtensionScheme, | 136 kExtensionScheme, |
| 137 kExtensionResourceScheme, | |
| 138 }; | 137 }; |
| 139 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 138 for (const char* scheme : kProtocolList) { |
| 140 if (url.scheme() == kProtocolList[i]) | 139 if (url.SchemeIs(scheme)) |
| 141 return true; | 140 return true; |
| 142 } | 141 } |
| 143 return false; | 142 return false; |
| 144 } | 143 } |
| 145 | 144 |
| 146 void ShellContentBrowserClient::SiteInstanceGotProcess( | 145 void ShellContentBrowserClient::SiteInstanceGotProcess( |
| 147 content::SiteInstance* site_instance) { | 146 content::SiteInstance* site_instance) { |
| 148 // If this isn't an extension renderer there's nothing to do. | 147 // If this isn't an extension renderer there's nothing to do. |
| 149 const Extension* extension = GetExtension(site_instance); | 148 const Extension* extension = GetExtension(site_instance); |
| 150 if (!extension) | 149 if (!extension) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 270 |
| 272 const Extension* ShellContentBrowserClient::GetExtension( | 271 const Extension* ShellContentBrowserClient::GetExtension( |
| 273 content::SiteInstance* site_instance) { | 272 content::SiteInstance* site_instance) { |
| 274 ExtensionRegistry* registry = | 273 ExtensionRegistry* registry = |
| 275 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 274 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
| 276 return registry->enabled_extensions().GetExtensionOrAppByURL( | 275 return registry->enabled_extensions().GetExtensionOrAppByURL( |
| 277 site_instance->GetSiteURL()); | 276 site_instance->GetSiteURL()); |
| 278 } | 277 } |
| 279 | 278 |
| 280 } // namespace extensions | 279 } // namespace extensions |
| OLD | NEW |