| 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 "extensions/browser/extension_web_contents_observer.h" | 5 #include "extensions/browser/extension_web_contents_observer.h" |
| 6 | 6 |
| 7 #include "content/public/browser/child_process_security_policy.h" | 7 #include "content/public/browser/child_process_security_policy.h" |
| 8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
| 9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 const Extension* extension = ExtensionRegistry::Get(browser_context) | 218 const Extension* extension = ExtensionRegistry::Get(browser_context) |
| 219 ->enabled_extensions() | 219 ->enabled_extensions() |
| 220 .GetByID(extension_id); | 220 .GetByID(extension_id); |
| 221 if (!extension) | 221 if (!extension) |
| 222 return nullptr; | 222 return nullptr; |
| 223 | 223 |
| 224 if (verify_url) { | 224 if (verify_url) { |
| 225 const url::Origin& origin(render_frame_host->GetLastCommittedOrigin()); | 225 const url::Origin& origin(render_frame_host->GetLastCommittedOrigin()); |
| 226 // Without site isolation, this check is needed to eliminate non-extension | 226 // Without site isolation, this check is needed to eliminate non-extension |
| 227 // schemes. With site isolation, this is still needed to exclude sandboxed | 227 // schemes. With site isolation, this is still needed to exclude sandboxed |
| 228 // extension frames with a unique origin. | 228 // extension frames with an opaque origin. |
| 229 if (origin.unique() || | 229 if (origin.opaque() || |
| 230 site_url != content::SiteInstance::GetSiteForURL(browser_context, | 230 site_url != content::SiteInstance::GetSiteForURL(browser_context, |
| 231 origin.GetURL())) | 231 origin.GetURL())) |
| 232 return nullptr; | 232 return nullptr; |
| 233 } | 233 } |
| 234 | 234 |
| 235 return extension; | 235 return extension; |
| 236 } | 236 } |
| 237 | 237 |
| 238 const Extension* ExtensionWebContentsObserver::GetExtension( | 238 const Extension* ExtensionWebContentsObserver::GetExtension( |
| 239 content::RenderViewHost* render_view_host) { | 239 content::RenderViewHost* render_view_host) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // Since this is called for all existing RenderFrameHosts during the | 273 // Since this is called for all existing RenderFrameHosts during the |
| 274 // ExtensionWebContentsObserver's creation, it's possible that not all hosts | 274 // ExtensionWebContentsObserver's creation, it's possible that not all hosts |
| 275 // are ready. | 275 // are ready. |
| 276 // We only initialize the frame if the renderer counterpart is live; otherwise | 276 // We only initialize the frame if the renderer counterpart is live; otherwise |
| 277 // we wait for the RenderFrameCreated notification. | 277 // we wait for the RenderFrameCreated notification. |
| 278 if (render_frame_host->IsRenderFrameLive()) | 278 if (render_frame_host->IsRenderFrameLive()) |
| 279 InitializeRenderFrame(render_frame_host); | 279 InitializeRenderFrame(render_frame_host); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace extensions | 282 } // namespace extensions |
| OLD | NEW |