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 "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" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 module_system->Require("appView"); | 327 module_system->Require("appView"); |
328 } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 328 } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
329 module_system->Require("denyAppView"); | 329 module_system->Require("denyAppView"); |
330 } | 330 } |
331 | 331 |
332 if (extensions::FeatureSwitch::surface_worker()->IsEnabled() && | 332 if (extensions::FeatureSwitch::surface_worker()->IsEnabled() && |
333 context->GetAvailability("surfaceWorkerInternal").is_available()) { | 333 context->GetAvailability("surfaceWorkerInternal").is_available()) { |
334 module_system->Require("surfaceWorker"); | 334 module_system->Require("surfaceWorker"); |
335 } | 335 } |
336 | 336 |
| 337 if (context->GetAvailability("extensionViewInternal").is_available()) { |
| 338 module_system->Require("extensionView"); |
| 339 module_system->Require("extensionViewAttributes"); |
| 340 } |
| 341 |
337 // Note: setting up the WebView class here, not the chrome.webview API. | 342 // Note: setting up the WebView class here, not the chrome.webview API. |
338 // The API will be automatically set up when first used. | 343 // The API will be automatically set up when first used. |
339 if (context->GetAvailability("webViewInternal").is_available()) { | 344 if (context->GetAvailability("webViewInternal").is_available()) { |
340 module_system->Require("webView"); | 345 module_system->Require("webView"); |
341 module_system->Require("webViewApiMethods"); | 346 module_system->Require("webViewApiMethods"); |
342 module_system->Require("webViewAttributes"); | 347 module_system->Require("webViewAttributes"); |
343 if (context->GetAvailability("webViewExperimentalInternal") | 348 if (context->GetAvailability("webViewExperimentalInternal") |
344 .is_available()) { | 349 .is_available()) { |
345 module_system->Require("webViewExperimental"); | 350 module_system->Require("webViewExperimental"); |
346 } | 351 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 resources.push_back(std::make_pair("webRequest", | 549 resources.push_back(std::make_pair("webRequest", |
545 IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); | 550 IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); |
546 resources.push_back( | 551 resources.push_back( |
547 std::make_pair("webRequestInternal", | 552 std::make_pair("webRequestInternal", |
548 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); | 553 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); |
549 // Note: webView not webview so that this doesn't interfere with the | 554 // Note: webView not webview so that this doesn't interfere with the |
550 // chrome.webview API bindings. | 555 // chrome.webview API bindings. |
551 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); | 556 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); |
552 resources.push_back(std::make_pair("guestViewContainer", | 557 resources.push_back(std::make_pair("guestViewContainer", |
553 IDR_GUEST_VIEW_CONTAINER_JS)); | 558 IDR_GUEST_VIEW_CONTAINER_JS)); |
| 559 resources.push_back(std::make_pair("extensionView", IDR_EXTENSION_VIEW_JS)); |
| 560 resources.push_back(std::make_pair("extensionViewAttributes", |
| 561 IDR_EXTENSION_VIEW_ATTRIBUTES_JS)); |
| 562 resources.push_back(std::make_pair("extensionViewConstants", |
| 563 IDR_EXTENSION_VIEW_CONSTANTS_JS)); |
| 564 resources.push_back(std::make_pair( |
| 565 "extensionViewInternal", IDR_EXTENSION_VIEW_INTERNAL_CUSTOM_BINDINGS_JS)); |
554 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); | 566 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); |
555 resources.push_back(std::make_pair("surfaceWorker", IDR_SURFACE_VIEW_JS)); | 567 resources.push_back(std::make_pair("surfaceWorker", IDR_SURFACE_VIEW_JS)); |
556 resources.push_back(std::make_pair("webViewActionRequests", | 568 resources.push_back(std::make_pair("webViewActionRequests", |
557 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); | 569 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); |
558 resources.push_back(std::make_pair("webViewApiMethods", | 570 resources.push_back(std::make_pair("webViewApiMethods", |
559 IDR_WEB_VIEW_API_METHODS_JS)); | 571 IDR_WEB_VIEW_API_METHODS_JS)); |
560 resources.push_back(std::make_pair("webViewAttributes", | 572 resources.push_back(std::make_pair("webViewAttributes", |
561 IDR_WEB_VIEW_ATTRIBUTES_JS)); | 573 IDR_WEB_VIEW_ATTRIBUTES_JS)); |
562 resources.push_back(std::make_pair("webViewConstants", | 574 resources.push_back(std::make_pair("webViewConstants", |
563 IDR_WEB_VIEW_CONSTANTS_JS)); | 575 IDR_WEB_VIEW_CONSTANTS_JS)); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1101 } |
1090 } | 1102 } |
1091 } | 1103 } |
1092 | 1104 |
1093 void Dispatcher::EnableCustomElementWhiteList() { | 1105 void Dispatcher::EnableCustomElementWhiteList() { |
1094 blink::WebCustomElement::addEmbedderCustomElementName("appview"); | 1106 blink::WebCustomElement::addEmbedderCustomElementName("appview"); |
1095 blink::WebCustomElement::addEmbedderCustomElementName("appviewbrowserplugin"); | 1107 blink::WebCustomElement::addEmbedderCustomElementName("appviewbrowserplugin"); |
1096 blink::WebCustomElement::addEmbedderCustomElementName("extensionoptions"); | 1108 blink::WebCustomElement::addEmbedderCustomElementName("extensionoptions"); |
1097 blink::WebCustomElement::addEmbedderCustomElementName( | 1109 blink::WebCustomElement::addEmbedderCustomElementName( |
1098 "extensionoptionsbrowserplugin"); | 1110 "extensionoptionsbrowserplugin"); |
| 1111 blink::WebCustomElement::addEmbedderCustomElementName("extensionview"); |
| 1112 blink::WebCustomElement::addEmbedderCustomElementName( |
| 1113 "extensionviewbrowserplugin"); |
1099 blink::WebCustomElement::addEmbedderCustomElementName("webview"); | 1114 blink::WebCustomElement::addEmbedderCustomElementName("webview"); |
1100 blink::WebCustomElement::addEmbedderCustomElementName("webviewbrowserplugin"); | 1115 blink::WebCustomElement::addEmbedderCustomElementName("webviewbrowserplugin"); |
1101 blink::WebCustomElement::addEmbedderCustomElementName("surfaceview"); | 1116 blink::WebCustomElement::addEmbedderCustomElementName("surfaceview"); |
1102 blink::WebCustomElement::addEmbedderCustomElementName( | 1117 blink::WebCustomElement::addEmbedderCustomElementName( |
1103 "surfaceviewbrowserplugin"); | 1118 "surfaceviewbrowserplugin"); |
1104 } | 1119 } |
1105 | 1120 |
1106 void Dispatcher::UpdateBindings(const std::string& extension_id) { | 1121 void Dispatcher::UpdateBindings(const std::string& extension_id) { |
1107 script_context_set().ForEach(extension_id, | 1122 script_context_set().ForEach(extension_id, |
1108 base::Bind(&Dispatcher::UpdateBindingsForContext, | 1123 base::Bind(&Dispatcher::UpdateBindingsForContext, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 return v8::Handle<v8::Object>(); | 1443 return v8::Handle<v8::Object>(); |
1429 | 1444 |
1430 if (bind_name) | 1445 if (bind_name) |
1431 *bind_name = split.back(); | 1446 *bind_name = split.back(); |
1432 | 1447 |
1433 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1448 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1434 : bind_object; | 1449 : bind_object; |
1435 } | 1450 } |
1436 | 1451 |
1437 } // namespace extensions | 1452 } // namespace extensions |
OLD | NEW |