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 <memory> | |
10 #include <set> | 9 #include <set> |
11 #include <string> | |
12 #include <vector> | |
13 | 10 |
14 #include "base/command_line.h" | 11 #include "base/command_line.h" |
15 #include "base/debug/alias.h" | 12 #include "base/debug/alias.h" |
16 #include "base/debug/dump_without_crashing.h" | 13 #include "base/debug/dump_without_crashing.h" |
17 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
18 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
19 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
20 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/extension_web_ui.h" | 19 #include "chrome/browser/extensions/extension_web_ui.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 if (!vpn_service) | 677 if (!vpn_service) |
681 return nullptr; | 678 return nullptr; |
682 return vpn_service->GetVpnServiceProxy(); | 679 return vpn_service->GetVpnServiceProxy(); |
683 #else | 680 #else |
684 return nullptr; | 681 return nullptr; |
685 #endif | 682 #endif |
686 } | 683 } |
687 | 684 |
688 // static | 685 // static |
689 bool ChromeContentBrowserClientExtensionsPart:: | 686 bool ChromeContentBrowserClientExtensionsPart:: |
690 IsMainFrameSiteInstanceExcludedFromTopDocumentIsolation( | 687 ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( |
691 content::SiteInstance* main_frame_site_instance) { | 688 const GURL& subframe_url, |
692 // Disable TDI if the main frame's SiteInstance is a hosted app. | 689 content::SiteInstance* parent_site_instance) { |
693 // See also https://crbug.com/679011. | |
694 const Extension* extension = | 690 const Extension* extension = |
695 ExtensionRegistry::Get(main_frame_site_instance->GetBrowserContext()) | 691 ExtensionRegistry::Get(parent_site_instance->GetBrowserContext()) |
696 ->enabled_extensions() | 692 ->enabled_extensions() |
697 .GetExtensionOrAppByURL(main_frame_site_instance->GetSiteURL()); | 693 .GetExtensionOrAppByURL(parent_site_instance->GetSiteURL()); |
| 694 |
698 return extension && extension->is_hosted_app(); | 695 return extension && extension->is_hosted_app(); |
699 } | 696 } |
700 | 697 |
701 // static | 698 // static |
702 void ChromeContentBrowserClientExtensionsPart::RecordShouldAllowOpenURLFailure( | 699 void ChromeContentBrowserClientExtensionsPart::RecordShouldAllowOpenURLFailure( |
703 ShouldAllowOpenURLFailureReason reason, | 700 ShouldAllowOpenURLFailureReason reason, |
704 const GURL& site_url) { | 701 const GURL& site_url) { |
705 UMA_HISTOGRAM_ENUMERATION("Extensions.ShouldAllowOpenURL.Failure", reason, | 702 UMA_HISTOGRAM_ENUMERATION("Extensions.ShouldAllowOpenURL.Failure", reason, |
706 FAILURE_LAST); | 703 FAILURE_LAST); |
707 | 704 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 command_line->AppendSwitch(switches::kExtensionProcess); | 882 command_line->AppendSwitch(switches::kExtensionProcess); |
886 } | 883 } |
887 } | 884 } |
888 | 885 |
889 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { | 886 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { |
890 content::ResourceDispatcherHost::Get()->RegisterInterceptor( | 887 content::ResourceDispatcherHost::Get()->RegisterInterceptor( |
891 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); | 888 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); |
892 } | 889 } |
893 | 890 |
894 } // namespace extensions | 891 } // namespace extensions |
OLD | NEW |