| 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_extension_web_contents_observer.h" | 5 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/extensions/error_console/error_console.h" | 10 #include "chrome/browser/extensions/error_console/error_console.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/window_controller.h" | 12 #include "chrome/browser/extensions/window_controller.h" |
| 13 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 13 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 14 #include "chrome/common/extensions/chrome_extension_messages.h" | 14 #include "chrome/common/extensions/chrome_extension_messages.h" |
| 15 #include "chrome/common/extensions/extension_process_policy.h" | 15 #include "chrome/common/extensions/extension_process_policy.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "components/rappor/rappor_service_impl.h" | 17 #include "components/rappor/rappor_service_impl.h" |
| 18 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 19 #include "content/public/browser/child_process_security_policy.h" | 19 #include "content/public/browser/child_process_security_policy.h" |
| 20 #include "content/public/browser/navigation_handle.h" |
| 20 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 21 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 24 #include "extensions/browser/extension_registry.h" | 25 #include "extensions/browser/extension_registry.h" |
| 25 #include "extensions/browser/extension_system.h" | 26 #include "extensions/browser/extension_system.h" |
| 26 #include "extensions/common/constants.h" | 27 #include "extensions/common/constants.h" |
| 27 #include "extensions/common/extension_messages.h" | 28 #include "extensions/common/extension_messages.h" |
| 28 #include "extensions/common/extension_urls.h" | 29 #include "extensions/common/extension_urls.h" |
| 29 #include "extensions/common/switches.h" | 30 #include "extensions/common/switches.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 extension->is_legacy_packaged_app() || | 72 extension->is_legacy_packaged_app() || |
| 72 (extension->is_platform_app() && | 73 (extension->is_platform_app() && |
| 73 Manifest::IsComponentLocation(extension->location()))) { | 74 Manifest::IsComponentLocation(extension->location()))) { |
| 74 policy->GrantOrigin(process_id, | 75 policy->GrantOrigin(process_id, |
| 75 url::Origin(GURL(chrome::kChromeUIFaviconURL))); | 76 url::Origin(GURL(chrome::kChromeUIFaviconURL))); |
| 76 policy->GrantOrigin(process_id, | 77 policy->GrantOrigin(process_id, |
| 77 url::Origin(GURL(chrome::kChromeUIExtensionIconURL))); | 78 url::Origin(GURL(chrome::kChromeUIExtensionIconURL))); |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 void ChromeExtensionWebContentsObserver::DidCommitProvisionalLoadForFrame( | 82 void ChromeExtensionWebContentsObserver::DidFinishNavigation( |
| 82 content::RenderFrameHost* render_frame_host, | 83 content::NavigationHandle* navigation_handle) { |
| 83 const GURL& url, | 84 ExtensionWebContentsObserver::DidFinishNavigation(navigation_handle); |
| 84 ui::PageTransition transition_type) { | 85 if (navigation_handle->HasCommitted()) |
| 85 ExtensionWebContentsObserver::DidCommitProvisionalLoadForFrame( | 86 SetExtensionIsolationTrial(navigation_handle->GetRenderFrameHost()); |
| 86 render_frame_host, url, transition_type); | |
| 87 SetExtensionIsolationTrial(render_frame_host); | |
| 88 } | 87 } |
| 89 | 88 |
| 90 bool ChromeExtensionWebContentsObserver::OnMessageReceived( | 89 bool ChromeExtensionWebContentsObserver::OnMessageReceived( |
| 91 const IPC::Message& message, | 90 const IPC::Message& message, |
| 92 content::RenderFrameHost* render_frame_host) { | 91 content::RenderFrameHost* render_frame_host) { |
| 93 if (ExtensionWebContentsObserver::OnMessageReceived(message, | 92 if (ExtensionWebContentsObserver::OnMessageReceived(message, |
| 94 render_frame_host)) { | 93 render_frame_host)) { |
| 95 return true; | 94 return true; |
| 96 } | 95 } |
| 97 | 96 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 g_browser_process->rappor_service()) { | 222 g_browser_process->rappor_service()) { |
| 224 const std::string& extension_id = | 223 const std::string& extension_id = |
| 225 parent_is_extension ? parent_url.host() : frame_url.host(); | 224 parent_is_extension ? parent_url.host() : frame_url.host(); |
| 226 rappor->RecordSampleString("Extensions.AffectedByIsolateExtensions", | 225 rappor->RecordSampleString("Extensions.AffectedByIsolateExtensions", |
| 227 rappor::UMA_RAPPOR_TYPE, extension_id); | 226 rappor::UMA_RAPPOR_TYPE, extension_id); |
| 228 } | 227 } |
| 229 } | 228 } |
| 230 } | 229 } |
| 231 | 230 |
| 232 } // namespace extensions | 231 } // namespace extensions |
| OLD | NEW |