Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: extensions/browser/extension_web_contents_observer.cc

Issue 2716583003: Rename Origin.unique() to opaque().
Patch Set: Update new uses post-rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const Extension* extension = ExtensionRegistry::Get(browser_context) 219 const Extension* extension = ExtensionRegistry::Get(browser_context)
220 ->enabled_extensions() 220 ->enabled_extensions()
221 .GetByID(extension_id); 221 .GetByID(extension_id);
222 if (!extension) 222 if (!extension)
223 return nullptr; 223 return nullptr;
224 224
225 if (verify_url) { 225 if (verify_url) {
226 const url::Origin& origin(render_frame_host->GetLastCommittedOrigin()); 226 const url::Origin& origin(render_frame_host->GetLastCommittedOrigin());
227 // Without site isolation, this check is needed to eliminate non-extension 227 // Without site isolation, this check is needed to eliminate non-extension
228 // schemes. With site isolation, this is still needed to exclude sandboxed 228 // schemes. With site isolation, this is still needed to exclude sandboxed
229 // extension frames with a unique origin. 229 // extension frames with an opaque origin.
230 if (origin.unique() || 230 if (origin.opaque() || site_url != content::SiteInstance::GetSiteForURL(
231 site_url != content::SiteInstance::GetSiteForURL(browser_context, 231 browser_context, origin.GetURL()))
232 origin.GetURL()))
233 return nullptr; 232 return nullptr;
234 } 233 }
235 234
236 return extension; 235 return extension;
237 } 236 }
238 237
239 const Extension* ExtensionWebContentsObserver::GetExtension( 238 const Extension* ExtensionWebContentsObserver::GetExtension(
240 content::RenderViewHost* render_view_host) { 239 content::RenderViewHost* render_view_host) {
241 std::string extension_id = GetExtensionId(render_view_host); 240 std::string extension_id = GetExtensionId(render_view_host);
242 if (extension_id.empty()) 241 if (extension_id.empty())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // Since this is called for all existing RenderFrameHosts during the 273 // Since this is called for all existing RenderFrameHosts during the
275 // ExtensionWebContentsObserver's creation, it's possible that not all hosts 274 // ExtensionWebContentsObserver's creation, it's possible that not all hosts
276 // are ready. 275 // are ready.
277 // 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
278 // we wait for the RenderFrameCreated notification. 277 // we wait for the RenderFrameCreated notification.
279 if (render_frame_host->IsRenderFrameLive()) 278 if (render_frame_host->IsRenderFrameLive())
280 InitializeRenderFrame(render_frame_host); 279 InitializeRenderFrame(render_frame_host);
281 } 280 }
282 281
283 } // namespace extensions 282 } // namespace extensions
OLDNEW
« no previous file with comments | « content/shell/browser/shell_content_browser_client.cc ('k') | media/audio/audio_output_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698