| 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 "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!extension) | 244 if (!extension) |
| 245 return url; | 245 return url; |
| 246 | 246 |
| 247 // Bookmark apps do not use the hosted app process model, and should be | 247 // Bookmark apps do not use the hosted app process model, and should be |
| 248 // treated as normal URLs. | 248 // treated as normal URLs. |
| 249 if (extension->from_bookmark()) | 249 if (extension->from_bookmark()) |
| 250 return url; | 250 return url; |
| 251 | 251 |
| 252 // If the URL is part of an extension's web extent, convert it to an | 252 // If the URL is part of an extension's web extent, convert it to an |
| 253 // extension URL. | 253 // extension URL. |
| 254 return extension->GetResourceURL(url.path()); | 254 return extension->GetResourceURL(url.path().as_string()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 // static | 257 // static |
| 258 bool ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( | 258 bool ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( |
| 259 Profile* profile, const GURL& effective_url) { | 259 Profile* profile, const GURL& effective_url) { |
| 260 if (!effective_url.SchemeIs(kExtensionScheme)) | 260 if (!effective_url.SchemeIs(kExtensionScheme)) |
| 261 return false; | 261 return false; |
| 262 | 262 |
| 263 ExtensionRegistry* registry = ExtensionRegistry::Get(profile); | 263 ExtensionRegistry* registry = ExtensionRegistry::Get(profile); |
| 264 if (!registry) | 264 if (!registry) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 char to_origin_copy[256]; | 569 char to_origin_copy[256]; |
| 570 base::strlcpy(to_origin_copy, to_origin.Serialize().c_str(), | 570 base::strlcpy(to_origin_copy, to_origin.Serialize().c_str(), |
| 571 arraysize(to_origin_copy)); | 571 arraysize(to_origin_copy)); |
| 572 base::debug::Alias(&to_origin_copy); | 572 base::debug::Alias(&to_origin_copy); |
| 573 base::debug::DumpWithoutCrashing(); | 573 base::debug::DumpWithoutCrashing(); |
| 574 | 574 |
| 575 *result = false; | 575 *result = false; |
| 576 return true; | 576 return true; |
| 577 } | 577 } |
| 578 | 578 |
| 579 if (WebAccessibleResourcesInfo::IsResourceWebAccessible(to_extension, | 579 if (WebAccessibleResourcesInfo::IsResourceWebAccessible( |
| 580 to_url.path())) { | 580 to_extension, to_url.path().as_string())) { |
| 581 *result = true; | 581 *result = true; |
| 582 return true; | 582 return true; |
| 583 } | 583 } |
| 584 | 584 |
| 585 if (!site_url.SchemeIsHTTPOrHTTPS() && !site_url.SchemeIs(kExtensionScheme)) { | 585 if (!site_url.SchemeIsHTTPOrHTTPS() && !site_url.SchemeIs(kExtensionScheme)) { |
| 586 RecordShowAllowOpenURLFailure( | 586 RecordShowAllowOpenURLFailure( |
| 587 FAILURE_SCHEME_NOT_HTTP_OR_HTTPS_OR_EXTENSION); | 587 FAILURE_SCHEME_NOT_HTTP_OR_HTTPS_OR_EXTENSION); |
| 588 | 588 |
| 589 // TODO(alexmos): Previous version of this function skipped the | 589 // TODO(alexmos): Previous version of this function skipped the |
| 590 // web-accessible resource checks in this case. Collect data to catch | 590 // web-accessible resource checks in this case. Collect data to catch |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 command_line->AppendSwitch(switches::kExtensionProcess); | 757 command_line->AppendSwitch(switches::kExtensionProcess); |
| 758 } | 758 } |
| 759 } | 759 } |
| 760 | 760 |
| 761 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { | 761 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { |
| 762 content::ResourceDispatcherHost::Get()->RegisterInterceptor( | 762 content::ResourceDispatcherHost::Get()->RegisterInterceptor( |
| 763 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); | 763 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); |
| 764 } | 764 } |
| 765 | 765 |
| 766 } // namespace extensions | 766 } // namespace extensions |
| OLD | NEW |