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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 499 } |
500 | 500 |
501 // static | 501 // static |
502 bool ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( | 502 bool ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( |
503 const GURL& scope, | 503 const GURL& scope, |
504 const GURL& first_party_url, | 504 const GURL& first_party_url, |
505 content::ResourceContext* context, | 505 content::ResourceContext* context, |
506 int render_process_id, | 506 int render_process_id, |
507 int render_frame_id) { | 507 int render_frame_id) { |
508 // We only care about extension urls. | 508 // We only care about extension urls. |
509 // TODO(devlin): Also address chrome-extension-resource. | |
510 if (!first_party_url.SchemeIs(kExtensionScheme)) | 509 if (!first_party_url.SchemeIs(kExtensionScheme)) |
511 return true; | 510 return true; |
512 | 511 |
513 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 512 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
514 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); | 513 InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); |
515 const Extension* extension = | 514 const Extension* extension = |
516 extension_info_map->extensions().GetExtensionOrAppByURL(first_party_url); | 515 extension_info_map->extensions().GetExtensionOrAppByURL(first_party_url); |
517 // Don't allow a service worker for an extension url with no extension (this | 516 // Don't allow a service worker for an extension url with no extension (this |
518 // could happen in the case of, e.g., an unloaded extension). | 517 // could happen in the case of, e.g., an unloaded extension). |
519 return extension != nullptr; | 518 return extension != nullptr; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 command_line->AppendSwitch(switches::kExtensionProcess); | 800 command_line->AppendSwitch(switches::kExtensionProcess); |
802 } | 801 } |
803 } | 802 } |
804 | 803 |
805 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { | 804 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { |
806 content::ResourceDispatcherHost::Get()->RegisterInterceptor( | 805 content::ResourceDispatcherHost::Get()->RegisterInterceptor( |
807 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); | 806 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); |
808 } | 807 } |
809 | 808 |
810 } // namespace extensions | 809 } // namespace extensions |
OLD | NEW |