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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Partial fixes to Nasko's comments. Created 5 years, 5 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/renderer/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "content/grit/content_resources.h" 19 #include "content/grit/content_resources.h"
20 #include "content/public/child/v8_value_converter.h" 20 #include "content/public/child/v8_value_converter.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "content/public/common/site_isolation_policy.h"
22 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
23 #include "content/public/renderer/render_frame.h" 24 #include "content/public/renderer/render_frame.h"
24 #include "content/public/renderer/render_thread.h" 25 #include "content/public/renderer/render_thread.h"
25 #include "extensions/common/api/messaging/message.h" 26 #include "extensions/common/api/messaging/message.h"
26 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
27 #include "extensions/common/extension_api.h" 28 #include "extensions/common/extension_api.h"
28 #include "extensions/common/extension_messages.h" 29 #include "extensions/common/extension_messages.h"
29 #include "extensions/common/extension_urls.h" 30 #include "extensions/common/extension_urls.h"
30 #include "extensions/common/feature_switch.h" 31 #include "extensions/common/feature_switch.h"
31 #include "extensions/common/features/feature.h" 32 #include "extensions/common/features/feature.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 "extensionViewInternal", IDR_EXTENSION_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); 467 "extensionViewInternal", IDR_EXTENSION_VIEW_INTERNAL_CUSTOM_BINDINGS_JS));
467 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); 468 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS));
468 resources.push_back(std::make_pair("guestViewAttributes", 469 resources.push_back(std::make_pair("guestViewAttributes",
469 IDR_GUEST_VIEW_ATTRIBUTES_JS)); 470 IDR_GUEST_VIEW_ATTRIBUTES_JS));
470 resources.push_back(std::make_pair("guestViewContainer", 471 resources.push_back(std::make_pair("guestViewContainer",
471 IDR_GUEST_VIEW_CONTAINER_JS)); 472 IDR_GUEST_VIEW_CONTAINER_JS));
472 resources.push_back(std::make_pair("guestViewDeny", IDR_GUEST_VIEW_DENY_JS)); 473 resources.push_back(std::make_pair("guestViewDeny", IDR_GUEST_VIEW_DENY_JS));
473 resources.push_back(std::make_pair("guestViewEvents", 474 resources.push_back(std::make_pair("guestViewEvents",
474 IDR_GUEST_VIEW_EVENTS_JS)); 475 IDR_GUEST_VIEW_EVENTS_JS));
475 476
476 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 477 if (content::SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
Charlie Reis 2015/07/13 22:13:15 This one is for webview (GuestsShouldUseCrossProce
ncarter (slow) 2015/07/20 17:45:46 Done.
477 ::switches::kSitePerProcess)) {
478 resources.push_back(std::make_pair("guestViewIframe", 478 resources.push_back(std::make_pair("guestViewIframe",
479 IDR_GUEST_VIEW_IFRAME_JS)); 479 IDR_GUEST_VIEW_IFRAME_JS));
480 resources.push_back(std::make_pair("guestViewIframeContainer", 480 resources.push_back(std::make_pair("guestViewIframeContainer",
481 IDR_GUEST_VIEW_IFRAME_CONTAINER_JS)); 481 IDR_GUEST_VIEW_IFRAME_CONTAINER_JS));
482 } 482 }
483 483
484 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS)); 484 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
485 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS)); 485 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS));
486 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS)); 486 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS));
487 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS)); 487 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS));
(...skipping 23 matching lines...) Expand all
511 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); 511 IDR_WEB_VIEW_ACTION_REQUESTS_JS));
512 resources.push_back(std::make_pair("webViewApiMethods", 512 resources.push_back(std::make_pair("webViewApiMethods",
513 IDR_WEB_VIEW_API_METHODS_JS)); 513 IDR_WEB_VIEW_API_METHODS_JS));
514 resources.push_back(std::make_pair("webViewAttributes", 514 resources.push_back(std::make_pair("webViewAttributes",
515 IDR_WEB_VIEW_ATTRIBUTES_JS)); 515 IDR_WEB_VIEW_ATTRIBUTES_JS));
516 resources.push_back(std::make_pair("webViewConstants", 516 resources.push_back(std::make_pair("webViewConstants",
517 IDR_WEB_VIEW_CONSTANTS_JS)); 517 IDR_WEB_VIEW_CONSTANTS_JS));
518 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); 518 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS));
519 resources.push_back(std::make_pair("webViewInternal", 519 resources.push_back(std::make_pair("webViewInternal",
520 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); 520 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS));
521 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 521 if (content::SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
Charlie Reis 2015/07/13 22:13:15 Ditto.
ncarter (slow) 2015/07/20 17:45:46 Done.
522 ::switches::kSitePerProcess)) {
523 resources.push_back(std::make_pair("webViewIframe", 522 resources.push_back(std::make_pair("webViewIframe",
524 IDR_WEB_VIEW_IFRAME_JS)); 523 IDR_WEB_VIEW_IFRAME_JS));
525 } 524 }
526 resources.push_back( 525 resources.push_back(
527 std::make_pair(mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS)); 526 std::make_pair(mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS));
528 resources.push_back( 527 resources.push_back(
529 std::make_pair(mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS)); 528 std::make_pair(mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS));
530 resources.push_back( 529 resources.push_back(
531 std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS)); 530 std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS));
532 resources.push_back( 531 resources.push_back(
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 context->GetAvailability("surfaceWorkerInternal").is_available()) { 1425 context->GetAvailability("surfaceWorkerInternal").is_available()) {
1427 module_system->Require("surfaceWorker"); 1426 module_system->Require("surfaceWorker");
1428 } 1427 }
1429 1428
1430 // Require WebView. 1429 // Require WebView.
1431 if (context->GetAvailability("webViewInternal").is_available()) { 1430 if (context->GetAvailability("webViewInternal").is_available()) {
1432 module_system->Require("webView"); 1431 module_system->Require("webView");
1433 module_system->Require("webViewApiMethods"); 1432 module_system->Require("webViewApiMethods");
1434 module_system->Require("webViewAttributes"); 1433 module_system->Require("webViewAttributes");
1435 1434
1436 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1435 if (content::SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
Charlie Reis 2015/07/13 22:13:15 Ditto.
ncarter (slow) 2015/07/20 17:45:46 Done.
1437 ::switches::kSitePerProcess)) {
1438 module_system->Require("webViewIframe"); 1436 module_system->Require("webViewIframe");
1439 } 1437 }
1440 } 1438 }
1441 1439
1442 // The "guestViewDeny" module must always be loaded last. It registers 1440 // The "guestViewDeny" module must always be loaded last. It registers
1443 // error-providing custom elements for the GuestView types that are not 1441 // error-providing custom elements for the GuestView types that are not
1444 // available, and thus all of those types must have been checked and loaded 1442 // available, and thus all of those types must have been checked and loaded
1445 // (or not loaded) beforehand. 1443 // (or not loaded) beforehand.
1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1444 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1447 module_system->Require("guestViewDeny"); 1445 module_system->Require("guestViewDeny");
1448 } 1446 }
1449 } 1447 }
1450 1448
1451 } // namespace extensions 1449 } // namespace extensions
OLDNEW
« content/public/common/site_isolation_policy.cc ('K') | « content/renderer/render_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698