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

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: Attempt to fix compile. Created 5 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
« no previous file with comments | « content/renderer/render_view_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 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/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "content/grit/content_resources.h" 20 #include "content/grit/content_resources.h"
21 #include "content/public/child/v8_value_converter.h" 21 #include "content/public/child/v8_value_converter.h"
22 #include "content/public/common/browser_plugin_guest_mode.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
23 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
24 #include "content/public/renderer/render_frame.h" 25 #include "content/public/renderer/render_frame.h"
25 #include "content/public/renderer/render_thread.h" 26 #include "content/public/renderer/render_thread.h"
26 #include "extensions/common/api/messaging/message.h" 27 #include "extensions/common/api/messaging/message.h"
27 #include "extensions/common/constants.h" 28 #include "extensions/common/constants.h"
28 #include "extensions/common/extension_api.h" 29 #include "extensions/common/extension_api.h"
29 #include "extensions/common/extension_messages.h" 30 #include "extensions/common/extension_messages.h"
30 #include "extensions/common/extension_urls.h" 31 #include "extensions/common/extension_urls.h"
31 #include "extensions/common/feature_switch.h" 32 #include "extensions/common/feature_switch.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 "extensionViewInternal", IDR_EXTENSION_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); 466 "extensionViewInternal", IDR_EXTENSION_VIEW_INTERNAL_CUSTOM_BINDINGS_JS));
466 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); 467 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS));
467 resources.push_back(std::make_pair("guestViewAttributes", 468 resources.push_back(std::make_pair("guestViewAttributes",
468 IDR_GUEST_VIEW_ATTRIBUTES_JS)); 469 IDR_GUEST_VIEW_ATTRIBUTES_JS));
469 resources.push_back(std::make_pair("guestViewContainer", 470 resources.push_back(std::make_pair("guestViewContainer",
470 IDR_GUEST_VIEW_CONTAINER_JS)); 471 IDR_GUEST_VIEW_CONTAINER_JS));
471 resources.push_back(std::make_pair("guestViewDeny", IDR_GUEST_VIEW_DENY_JS)); 472 resources.push_back(std::make_pair("guestViewDeny", IDR_GUEST_VIEW_DENY_JS));
472 resources.push_back(std::make_pair("guestViewEvents", 473 resources.push_back(std::make_pair("guestViewEvents",
473 IDR_GUEST_VIEW_EVENTS_JS)); 474 IDR_GUEST_VIEW_EVENTS_JS));
474 475
475 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 476 if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
476 ::switches::kSitePerProcess)) {
477 resources.push_back(std::make_pair("guestViewIframe", 477 resources.push_back(std::make_pair("guestViewIframe",
478 IDR_GUEST_VIEW_IFRAME_JS)); 478 IDR_GUEST_VIEW_IFRAME_JS));
479 resources.push_back(std::make_pair("guestViewIframeContainer", 479 resources.push_back(std::make_pair("guestViewIframeContainer",
480 IDR_GUEST_VIEW_IFRAME_CONTAINER_JS)); 480 IDR_GUEST_VIEW_IFRAME_CONTAINER_JS));
481 } 481 }
482 482
483 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS)); 483 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
484 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS)); 484 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS));
485 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS)); 485 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS));
486 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS)); 486 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS));
(...skipping 23 matching lines...) Expand all
510 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); 510 IDR_WEB_VIEW_ACTION_REQUESTS_JS));
511 resources.push_back(std::make_pair("webViewApiMethods", 511 resources.push_back(std::make_pair("webViewApiMethods",
512 IDR_WEB_VIEW_API_METHODS_JS)); 512 IDR_WEB_VIEW_API_METHODS_JS));
513 resources.push_back(std::make_pair("webViewAttributes", 513 resources.push_back(std::make_pair("webViewAttributes",
514 IDR_WEB_VIEW_ATTRIBUTES_JS)); 514 IDR_WEB_VIEW_ATTRIBUTES_JS));
515 resources.push_back(std::make_pair("webViewConstants", 515 resources.push_back(std::make_pair("webViewConstants",
516 IDR_WEB_VIEW_CONSTANTS_JS)); 516 IDR_WEB_VIEW_CONSTANTS_JS));
517 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); 517 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS));
518 resources.push_back(std::make_pair("webViewInternal", 518 resources.push_back(std::make_pair("webViewInternal",
519 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); 519 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS));
520 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 520 if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
521 ::switches::kSitePerProcess)) {
522 resources.push_back(std::make_pair("webViewIframe", 521 resources.push_back(std::make_pair("webViewIframe",
523 IDR_WEB_VIEW_IFRAME_JS)); 522 IDR_WEB_VIEW_IFRAME_JS));
524 } 523 }
525 resources.push_back( 524 resources.push_back(
526 std::make_pair(mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS)); 525 std::make_pair(mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS));
527 resources.push_back( 526 resources.push_back(
528 std::make_pair(mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS)); 527 std::make_pair(mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS));
529 resources.push_back( 528 resources.push_back(
530 std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS)); 529 std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS));
531 resources.push_back( 530 resources.push_back(
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 context->GetAvailability("surfaceWorkerInternal").is_available()) { 1428 context->GetAvailability("surfaceWorkerInternal").is_available()) {
1430 module_system->Require("surfaceWorker"); 1429 module_system->Require("surfaceWorker");
1431 } 1430 }
1432 1431
1433 // Require WebView. 1432 // Require WebView.
1434 if (context->GetAvailability("webViewInternal").is_available()) { 1433 if (context->GetAvailability("webViewInternal").is_available()) {
1435 module_system->Require("webView"); 1434 module_system->Require("webView");
1436 module_system->Require("webViewApiMethods"); 1435 module_system->Require("webViewApiMethods");
1437 module_system->Require("webViewAttributes"); 1436 module_system->Require("webViewAttributes");
1438 1437
1439 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1438 if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
1440 ::switches::kSitePerProcess)) {
1441 module_system->Require("webViewIframe"); 1439 module_system->Require("webViewIframe");
1442 } 1440 }
1443 } 1441 }
1444 1442
1445 // The "guestViewDeny" module must always be loaded last. It registers 1443 // The "guestViewDeny" module must always be loaded last. It registers
1446 // error-providing custom elements for the GuestView types that are not 1444 // error-providing custom elements for the GuestView types that are not
1447 // available, and thus all of those types must have been checked and loaded 1445 // available, and thus all of those types must have been checked and loaded
1448 // (or not loaded) beforehand. 1446 // (or not loaded) beforehand.
1449 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1447 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1450 module_system->Require("guestViewDeny"); 1448 module_system->Require("guestViewDeny");
1451 } 1449 }
1452 } 1450 }
1453 1451
1454 void Dispatcher::AddChannelSpecificFeatures() { 1452 void Dispatcher::AddChannelSpecificFeatures() {
1455 // chrome-extension: resources should be allowed to register a Service Worker. 1453 // chrome-extension: resources should be allowed to register a Service Worker.
1456 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) 1454 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker)
1457 ->IsAvailableToEnvironment() 1455 ->IsAvailableToEnvironment()
1458 .is_available()) 1456 .is_available())
1459 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( 1457 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
1460 WebString::fromUTF8(kExtensionScheme)); 1458 WebString::fromUTF8(kExtensionScheme));
1461 } 1459 }
1462 1460
1463 } // namespace extensions 1461 } // namespace extensions
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698