| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void ChromeExtensionWebContentsObserver::RenderViewCreated( | 44 void ChromeExtensionWebContentsObserver::RenderViewCreated( |
| 45 content::RenderViewHost* render_view_host) { | 45 content::RenderViewHost* render_view_host) { |
| 46 ReloadIfTerminated(render_view_host); | 46 ReloadIfTerminated(render_view_host); |
| 47 ExtensionWebContentsObserver::RenderViewCreated(render_view_host); | 47 ExtensionWebContentsObserver::RenderViewCreated(render_view_host); |
| 48 | 48 |
| 49 const Extension* extension = GetExtension(render_view_host); | 49 const Extension* extension = GetExtension(render_view_host); |
| 50 if (!extension) | 50 if (!extension) |
| 51 return; | 51 return; |
| 52 | 52 |
| 53 int process_id = render_view_host->GetProcess()->GetID(); | 53 int process_id = render_view_host->GetProcess()->GetID(); |
| 54 auto policy = content::ChildProcessSecurityPolicy::GetInstance(); | 54 auto* policy = content::ChildProcessSecurityPolicy::GetInstance(); |
| 55 | 55 |
| 56 // Components of chrome that are implemented as extensions or platform apps | 56 // Components of chrome that are implemented as extensions or platform apps |
| 57 // are allowed to use chrome://resources/ and chrome://theme/ URLs. | 57 // are allowed to use chrome://resources/ and chrome://theme/ URLs. |
| 58 if ((extension->is_extension() || extension->is_platform_app()) && | 58 if ((extension->is_extension() || extension->is_platform_app()) && |
| 59 Manifest::IsComponentLocation(extension->location())) { | 59 Manifest::IsComponentLocation(extension->location())) { |
| 60 policy->GrantOrigin(process_id, | 60 policy->GrantOrigin(process_id, |
| 61 url::Origin(GURL(content::kChromeUIResourcesURL))); | 61 url::Origin(GURL(content::kChromeUIResourcesURL))); |
| 62 policy->GrantOrigin(process_id, | 62 policy->GrantOrigin(process_id, |
| 63 url::Origin(GURL(chrome::kChromeUIThemeURL))); | 63 url::Origin(GURL(chrome::kChromeUIThemeURL))); |
| 64 } | 64 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (rappor::RapporService* rappor = g_browser_process->rappor_service()) { | 222 if (rappor::RapporService* rappor = g_browser_process->rappor_service()) { |
| 223 const std::string& extension_id = | 223 const std::string& extension_id = |
| 224 parent_is_extension ? parent_url.host() : frame_url.host(); | 224 parent_is_extension ? parent_url.host() : frame_url.host(); |
| 225 rappor->RecordSample("Extensions.AffectedByIsolateExtensions", | 225 rappor->RecordSample("Extensions.AffectedByIsolateExtensions", |
| 226 rappor::UMA_RAPPOR_TYPE, extension_id); | 226 rappor::UMA_RAPPOR_TYPE, extension_id); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace extensions | 231 } // namespace extensions |
| OLD | NEW |