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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 if (is_within_platform_app) { | 321 if (is_within_platform_app) { |
322 module_system->Require("platformApp"); | 322 module_system->Require("platformApp"); |
323 } | 323 } |
324 | 324 |
325 if (context->GetAvailability("appViewEmbedderInternal").is_available()) { | 325 if (context->GetAvailability("appViewEmbedderInternal").is_available()) { |
326 module_system->Require("appView"); | 326 module_system->Require("appView"); |
327 } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 327 } else if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
328 module_system->Require("denyAppView"); | 328 module_system->Require("denyAppView"); |
329 } | 329 } |
330 | 330 |
331 if (extensions::FeatureSwitch::worker_frame()->IsEnabled() && | 331 if (extensions::FeatureSwitch::surface_worker()->IsEnabled() && |
332 context->GetAvailability("workerFrameInternal").is_available()) { | 332 context->GetAvailability("surfaceWorkerInternal").is_available()) { |
333 module_system->Require("workerframe"); | 333 module_system->Require("surfaceWorker"); |
334 } | 334 } |
335 | 335 |
336 // Note: setting up the WebView class here, not the chrome.webview API. | 336 // Note: setting up the WebView class here, not the chrome.webview API. |
337 // The API will be automatically set up when first used. | 337 // The API will be automatically set up when first used. |
338 if (context->GetAvailability("webViewInternal").is_available()) { | 338 if (context->GetAvailability("webViewInternal").is_available()) { |
339 module_system->Require("webView"); | 339 module_system->Require("webView"); |
340 module_system->Require("webViewApiMethods"); | 340 module_system->Require("webViewApiMethods"); |
341 module_system->Require("webViewAttributes"); | 341 module_system->Require("webViewAttributes"); |
342 if (context->GetAvailability("webViewExperimentalInternal") | 342 if (context->GetAvailability("webViewExperimentalInternal") |
343 .is_available()) { | 343 .is_available()) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); | 544 IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS)); |
545 resources.push_back( | 545 resources.push_back( |
546 std::make_pair("webRequestInternal", | 546 std::make_pair("webRequestInternal", |
547 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); | 547 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS)); |
548 // Note: webView not webview so that this doesn't interfere with the | 548 // Note: webView not webview so that this doesn't interfere with the |
549 // chrome.webview API bindings. | 549 // chrome.webview API bindings. |
550 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); | 550 resources.push_back(std::make_pair("guestView", IDR_GUEST_VIEW_JS)); |
551 resources.push_back(std::make_pair("guestViewContainer", | 551 resources.push_back(std::make_pair("guestViewContainer", |
552 IDR_GUEST_VIEW_CONTAINER_JS)); | 552 IDR_GUEST_VIEW_CONTAINER_JS)); |
553 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); | 553 resources.push_back(std::make_pair("webView", IDR_WEB_VIEW_JS)); |
554 resources.push_back(std::make_pair("workerframe", IDR_WORKER_FRAME_JS)); | 554 resources.push_back(std::make_pair("surfaceWorker", IDR_SURFACE_VIEW_JS)); |
555 resources.push_back(std::make_pair("webViewActionRequests", | 555 resources.push_back(std::make_pair("webViewActionRequests", |
556 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); | 556 IDR_WEB_VIEW_ACTION_REQUESTS_JS)); |
557 resources.push_back(std::make_pair("webViewApiMethods", | 557 resources.push_back(std::make_pair("webViewApiMethods", |
558 IDR_WEB_VIEW_API_METHODS_JS)); | 558 IDR_WEB_VIEW_API_METHODS_JS)); |
559 resources.push_back(std::make_pair("webViewAttributes", | 559 resources.push_back(std::make_pair("webViewAttributes", |
560 IDR_WEB_VIEW_ATTRIBUTES_JS)); | 560 IDR_WEB_VIEW_ATTRIBUTES_JS)); |
561 resources.push_back(std::make_pair("webViewConstants", | 561 resources.push_back(std::make_pair("webViewConstants", |
562 IDR_WEB_VIEW_CONSTANTS_JS)); | 562 IDR_WEB_VIEW_CONSTANTS_JS)); |
563 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); | 563 resources.push_back(std::make_pair("webViewEvents", IDR_WEB_VIEW_EVENTS_JS)); |
564 resources.push_back( | 564 resources.push_back( |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 } | 1080 } |
1081 | 1081 |
1082 void Dispatcher::EnableCustomElementWhiteList() { | 1082 void Dispatcher::EnableCustomElementWhiteList() { |
1083 blink::WebCustomElement::addEmbedderCustomElementName("appview"); | 1083 blink::WebCustomElement::addEmbedderCustomElementName("appview"); |
1084 blink::WebCustomElement::addEmbedderCustomElementName("appviewbrowserplugin"); | 1084 blink::WebCustomElement::addEmbedderCustomElementName("appviewbrowserplugin"); |
1085 blink::WebCustomElement::addEmbedderCustomElementName("extensionoptions"); | 1085 blink::WebCustomElement::addEmbedderCustomElementName("extensionoptions"); |
1086 blink::WebCustomElement::addEmbedderCustomElementName( | 1086 blink::WebCustomElement::addEmbedderCustomElementName( |
1087 "extensionoptionsbrowserplugin"); | 1087 "extensionoptionsbrowserplugin"); |
1088 blink::WebCustomElement::addEmbedderCustomElementName("webview"); | 1088 blink::WebCustomElement::addEmbedderCustomElementName("webview"); |
1089 blink::WebCustomElement::addEmbedderCustomElementName("webviewbrowserplugin"); | 1089 blink::WebCustomElement::addEmbedderCustomElementName("webviewbrowserplugin"); |
1090 blink::WebCustomElement::addEmbedderCustomElementName("workerframe"); | 1090 blink::WebCustomElement::addEmbedderCustomElementName("surfaceview"); |
1091 blink::WebCustomElement::addEmbedderCustomElementName( | 1091 blink::WebCustomElement::addEmbedderCustomElementName( |
1092 "workerframebrowserplugin"); | 1092 "surfaceviewbrowserplugin"); |
1093 } | 1093 } |
1094 | 1094 |
1095 void Dispatcher::UpdateBindings(const std::string& extension_id) { | 1095 void Dispatcher::UpdateBindings(const std::string& extension_id) { |
1096 script_context_set().ForEach(extension_id, | 1096 script_context_set().ForEach(extension_id, |
1097 base::Bind(&Dispatcher::UpdateBindingsForContext, | 1097 base::Bind(&Dispatcher::UpdateBindingsForContext, |
1098 base::Unretained(this))); | 1098 base::Unretained(this))); |
1099 } | 1099 } |
1100 | 1100 |
1101 void Dispatcher::UpdateBindingsForContext(ScriptContext* context) { | 1101 void Dispatcher::UpdateBindingsForContext(ScriptContext* context) { |
1102 v8::HandleScope handle_scope(context->isolate()); | 1102 v8::HandleScope handle_scope(context->isolate()); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 context->GetExtensionID(), | 1223 context->GetExtensionID(), |
1224 context->GetContextTypeDescription(), | 1224 context->GetContextTypeDescription(), |
1225 ExtensionsRendererClient::Get()->IsIncognitoProcess(), | 1225 ExtensionsRendererClient::Get()->IsIncognitoProcess(), |
1226 manifest_version, | 1226 manifest_version, |
1227 send_request_disabled))); | 1227 send_request_disabled))); |
1228 | 1228 |
1229 delegate_->RegisterNativeHandlers(this, module_system, context); | 1229 delegate_->RegisterNativeHandlers(this, module_system, context); |
1230 } | 1230 } |
1231 | 1231 |
1232 bool Dispatcher::IsRuntimeAvailableToContext(ScriptContext* context) { | 1232 bool Dispatcher::IsRuntimeAvailableToContext(ScriptContext* context) { |
1233 if (extensions::FeatureSwitch::worker_frame()->IsEnabled() && | 1233 if (extensions::FeatureSwitch::surface_worker()->IsEnabled() && |
1234 context->GetAvailability("workerFrameInternal").is_available()) { | 1234 context->GetAvailability("surfaceWorkerInternal").is_available()) { |
1235 return true; | 1235 return true; |
1236 } | 1236 } |
1237 for (const auto& extension : extensions_) { | 1237 for (const auto& extension : extensions_) { |
1238 ExternallyConnectableInfo* info = static_cast<ExternallyConnectableInfo*>( | 1238 ExternallyConnectableInfo* info = static_cast<ExternallyConnectableInfo*>( |
1239 extension->GetManifestData(manifest_keys::kExternallyConnectable)); | 1239 extension->GetManifestData(manifest_keys::kExternallyConnectable)); |
1240 if (info && info->matches.MatchesURL(context->GetURL())) | 1240 if (info && info->matches.MatchesURL(context->GetURL())) |
1241 return true; | 1241 return true; |
1242 } | 1242 } |
1243 return false; | 1243 return false; |
1244 } | 1244 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 return v8::Handle<v8::Object>(); | 1414 return v8::Handle<v8::Object>(); |
1415 | 1415 |
1416 if (bind_name) | 1416 if (bind_name) |
1417 *bind_name = split.back(); | 1417 *bind_name = split.back(); |
1418 | 1418 |
1419 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1419 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1420 : bind_object; | 1420 : bind_object; |
1421 } | 1421 } |
1422 | 1422 |
1423 } // namespace extensions | 1423 } // namespace extensions |
OLD | NEW |