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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2646683002: Implement OOPIFs within Devtools Extensions (Closed)
Patch Set: small URL fixes Created 3 years, 8 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
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 #include "content/browser/frame_host/render_frame_proxy_host.h" 33 #include "content/browser/frame_host/render_frame_proxy_host.h"
34 #include "content/browser/renderer_host/render_process_host_impl.h" 34 #include "content/browser/renderer_host/render_process_host_impl.h"
35 #include "content/browser/renderer_host/render_view_host_factory.h" 35 #include "content/browser/renderer_host/render_view_host_factory.h"
36 #include "content/browser/renderer_host/render_view_host_impl.h" 36 #include "content/browser/renderer_host/render_view_host_impl.h"
37 #include "content/browser/site_instance_impl.h" 37 #include "content/browser/site_instance_impl.h"
38 #include "content/browser/webui/web_ui_controller_factory_registry.h" 38 #include "content/browser/webui/web_ui_controller_factory_registry.h"
39 #include "content/common/frame_messages.h" 39 #include "content/common/frame_messages.h"
40 #include "content/common/frame_owner_properties.h" 40 #include "content/common/frame_owner_properties.h"
41 #include "content/common/site_isolation_policy.h" 41 #include "content/common/site_isolation_policy.h"
42 #include "content/common/view_messages.h" 42 #include "content/common/view_messages.h"
43 #include "content/public/browser/child_process_security_policy.h"
43 #include "content/public/browser/content_browser_client.h" 44 #include "content/public/browser/content_browser_client.h"
44 #include "content/public/browser/render_process_host_observer.h" 45 #include "content/public/browser/render_process_host_observer.h"
45 #include "content/public/browser/render_widget_host_iterator.h" 46 #include "content/public/browser/render_widget_host_iterator.h"
46 #include "content/public/browser/render_widget_host_view.h" 47 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/user_metrics.h" 48 #include "content/public/browser/user_metrics.h"
48 #include "content/public/common/browser_side_navigation_policy.h" 49 #include "content/public/common/browser_side_navigation_policy.h"
49 #include "content/public/common/content_switches.h" 50 #include "content/public/common/content_switches.h"
50 #include "content/public/common/referrer.h" 51 #include "content/public/common/referrer.h"
51 #include "content/public/common/url_constants.h" 52 #include "content/public/common/url_constants.h"
52 53
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 // chrome://settings, which currently has multiple "cross-site" subframes that 1288 // chrome://settings, which currently has multiple "cross-site" subframes that
1288 // don't need isolation. 1289 // don't need isolation.
1289 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() && 1290 if (SiteIsolationPolicy::AreCrossProcessFramesPossible() &&
1290 !frame_tree_node_->IsMainFrame()) { 1291 !frame_tree_node_->IsMainFrame()) {
1291 SiteInstance* parent_site_instance = 1292 SiteInstance* parent_site_instance =
1292 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); 1293 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance();
1293 if (parent_site_instance->GetSiteURL().SchemeIs(kChromeUIScheme) && 1294 if (parent_site_instance->GetSiteURL().SchemeIs(kChromeUIScheme) &&
1294 dest_url.SchemeIs(kChromeUIScheme)) { 1295 dest_url.SchemeIs(kChromeUIScheme)) {
1295 return SiteInstanceDescriptor(parent_site_instance); 1296 return SiteInstanceDescriptor(parent_site_instance);
1296 } 1297 }
1298 // TODO(alexmos, nick): Remove this once https://crbug.com/706169 is fixed.
1299 if (parent_site_instance->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) {
1300 url::Origin origin(dest_url);
1301 auto* policy = ChildProcessSecurityPolicy::GetInstance();
1302 // Some non-devtools origins (e.g., devtools extensions) have special
1303 // permission to stay in the devtools process.
1304 bool is_origin_allowed_in_devtools_process =
1305 policy->HasSpecificPermissionForOrigin(
1306 parent_site_instance->GetProcess()->GetID(), origin);
1307 if (origin.scheme() == kChromeDevToolsScheme ||
1308 is_origin_allowed_in_devtools_process) {
1309 return SiteInstanceDescriptor(parent_site_instance);
1310 }
1311 }
1297 } 1312 }
1298 1313
1299 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it 1314 // If we haven't used our SiteInstance (and thus RVH) yet, then we can use it
1300 // for this entry. We won't commit the SiteInstance to this site until the 1315 // for this entry. We won't commit the SiteInstance to this site until the
1301 // navigation commits (in DidNavigate), unless the navigation entry was 1316 // navigation commits (in DidNavigate), unless the navigation entry was
1302 // restored or it's a Web UI as described below. 1317 // restored or it's a Web UI as described below.
1303 if (!current_instance_impl->HasSite()) { 1318 if (!current_instance_impl->HasSite()) {
1304 // If we've already created a SiteInstance for our destination, we don't 1319 // If we've already created a SiteInstance for our destination, we don't
1305 // want to use this unused SiteInstance; use the existing one. (We don't 1320 // want to use this unused SiteInstance; use the existing one. (We don't
1306 // do this check if the current_instance has a site, because for now, we 1321 // do this check if the current_instance has a site, because for now, we
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 const GURL& dest_url) { 1480 const GURL& dest_url) {
1466 // A transfer is not needed if the current SiteInstance doesn't yet have a 1481 // A transfer is not needed if the current SiteInstance doesn't yet have a
1467 // site. This is the case for tests that use NavigateToURL. 1482 // site. This is the case for tests that use NavigateToURL.
1468 if (!rfh->GetSiteInstance()->HasSite()) 1483 if (!rfh->GetSiteInstance()->HasSite())
1469 return false; 1484 return false;
1470 1485
1471 // We do not currently swap processes for navigations in webview tag guests. 1486 // We do not currently swap processes for navigations in webview tag guests.
1472 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme)) 1487 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme))
1473 return false; 1488 return false;
1474 1489
1475 // Don't swap processes for extensions embedded in DevTools. See 1490 // TODO(alexmos, nick): Remove this once https://crbug.com/706169 is fixed.
1476 // https://crbug.com/564216. 1491 // Devtools pages and devtools extensions must stay in the devtools process.
1492 // See https://crbug.com/564216.
1477 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) { 1493 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) {
1478 // TODO(nick): https://crbug.com/570483 Check to see if |dest_url| is a 1494 url::Origin origin(dest_url);
1479 // devtools extension, and swap processes if not. 1495 auto* policy = ChildProcessSecurityPolicy::GetInstance();
1480 return false; 1496 // Some non-devtools origins (e.g., devtools extensions) have special
1497 // permission to stay in the devtools process.
1498 bool is_origin_allowed_in_devtools_process =
1499 policy->HasSpecificPermissionForOrigin(rfh->GetProcess()->GetID(),
1500 origin);
1501 return !(origin.scheme() == kChromeDevToolsScheme ||
1502 is_origin_allowed_in_devtools_process);
1481 } 1503 }
1482 1504
1483 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext(); 1505 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext();
1484 // TODO(nasko, nick): These following --site-per-process checks are 1506 // TODO(nasko, nick): These following --site-per-process checks are
1485 // overly simplistic. Update them to match all the cases 1507 // overly simplistic. Update them to match all the cases
1486 // considered by DetermineSiteInstanceForURL. 1508 // considered by DetermineSiteInstanceForURL.
1487 if (IsCurrentlySameSite(rfh, dest_url)) { 1509 if (IsCurrentlySameSite(rfh, dest_url)) {
1488 // The same site, no transition needed for security purposes, and we must 1510 // The same site, no transition needed for security purposes, and we must
1489 // keep the same SiteInstance for correctness of synchronous scripting. 1511 // keep the same SiteInstance for correctness of synchronous scripting.
1490 return false; 1512 return false;
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 delegate_->IsHidden()) { 2824 delegate_->IsHidden()) {
2803 if (delegate_->IsHidden()) { 2825 if (delegate_->IsHidden()) {
2804 render_frame_host_->GetView()->Hide(); 2826 render_frame_host_->GetView()->Hide();
2805 } else { 2827 } else {
2806 render_frame_host_->GetView()->Show(); 2828 render_frame_host_->GetView()->Show();
2807 } 2829 }
2808 } 2830 }
2809 } 2831 }
2810 2832
2811 } // namespace content 2833 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698