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/renderer/extensions/chrome_extensions_renderer_client.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 extensions::RendererExtensionRegistry::Get(); | 70 extensions::RendererExtensionRegistry::Get(); |
71 | 71 |
72 // If old_url is still empty and this is an initial navigation, then this is | 72 // If old_url is still empty and this is an initial navigation, then this is |
73 // a window.open operation. We should look at the opener URL. Note that the | 73 // a window.open operation. We should look at the opener URL. Note that the |
74 // opener is a local frame in this case. | 74 // opener is a local frame in this case. |
75 if (is_initial_navigation && old_url.is_empty() && frame->Opener()) { | 75 if (is_initial_navigation && old_url.is_empty() && frame->Opener()) { |
76 blink::WebLocalFrame* opener_frame = frame->Opener()->ToWebLocalFrame(); | 76 blink::WebLocalFrame* opener_frame = frame->Opener()->ToWebLocalFrame(); |
77 | 77 |
78 // We want to compare against the URL that determines the type of | 78 // We want to compare against the URL that determines the type of |
79 // process. Use the URL of the opener's local frame root, which will | 79 // process. Use the URL of the opener's local frame root, which will |
80 // correctly handle any site isolation modes (--site-per-process and | 80 // correctly handle any site isolation modes (e.g. --site-per-process). |
81 // --isolate-extensions). | |
82 blink::WebLocalFrame* local_root = opener_frame->LocalRoot(); | 81 blink::WebLocalFrame* local_root = opener_frame->LocalRoot(); |
83 old_url = local_root->GetDocument().Url(); | 82 old_url = local_root->GetDocument().Url(); |
84 | 83 |
85 // If we're about to open a normal web page from a same-origin opener stuck | 84 // If we're about to open a normal web page from a same-origin opener stuck |
86 // in an extension process (other than the Chrome Web Store), we want to | 85 // in an extension process (other than the Chrome Web Store), we want to |
87 // keep it in process to allow the opener to script it. | 86 // keep it in process to allow the opener to script it. |
88 blink::WebDocument opener_document = opener_frame->GetDocument(); | 87 blink::WebDocument opener_document = opener_frame->GetDocument(); |
89 blink::WebSecurityOrigin opener_origin = | 88 blink::WebSecurityOrigin opener_origin = |
90 opener_document.GetSecurityOrigin(); | 89 opener_document.GetSecurityOrigin(); |
91 bool opener_is_extension_url = | 90 bool opener_is_extension_url = |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 305 |
307 void ChromeExtensionsRendererClient::RunScriptsAtDocumentEnd( | 306 void ChromeExtensionsRendererClient::RunScriptsAtDocumentEnd( |
308 content::RenderFrame* render_frame) { | 307 content::RenderFrame* render_frame) { |
309 extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); | 308 extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); |
310 } | 309 } |
311 | 310 |
312 void ChromeExtensionsRendererClient::RunScriptsAtDocumentIdle( | 311 void ChromeExtensionsRendererClient::RunScriptsAtDocumentIdle( |
313 content::RenderFrame* render_frame) { | 312 content::RenderFrame* render_frame) { |
314 extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); | 313 extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); |
315 } | 314 } |
OLD | NEW |