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