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

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

Issue 642863003: Moving last app_view bits to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 UpdateBindingsForContext(context); 319 UpdateBindingsForContext(context);
320 320
321 bool is_within_platform_app = IsWithinPlatformApp(); 321 bool is_within_platform_app = IsWithinPlatformApp();
322 // Inject custom JS into the platform app context. 322 // Inject custom JS into the platform app context.
323 if (is_within_platform_app) { 323 if (is_within_platform_app) {
324 module_system->Require("platformApp"); 324 module_system->Require("platformApp");
325 } 325 }
326 326
327 if (context->GetAvailability("appViewEmbedderInternal").is_available()) {
328 module_system->Require("appView");
329 } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
330 module_system->Require("denyAppView");
331 }
332
327 // Note: setting up the WebView class here, not the chrome.webview API. 333 // Note: setting up the WebView class here, not the chrome.webview API.
328 // The API will be automatically set up when first used. 334 // The API will be automatically set up when first used.
329 if (context->GetAvailability("webViewInternal").is_available()) { 335 if (context->GetAvailability("webViewInternal").is_available()) {
330 module_system->Require("webView"); 336 module_system->Require("webView");
331 if (context->GetAvailability("webViewExperimentalInternal") 337 if (context->GetAvailability("webViewExperimentalInternal")
332 .is_available()) { 338 .is_available()) {
333 module_system->Require("webViewExperimental"); 339 module_system->Require("webViewExperimental");
334 } 340 }
335 } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { 341 } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
336 module_system->Require("denyWebView"); 342 module_system->Require("denyWebView");
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // |port_id| is a source port, std::map::erase() will just silently fail 512 // |port_id| is a source port, std::map::erase() will just silently fail
507 // here as a no-op. 513 // here as a no-op.
508 port_to_tab_id_map_.erase(port_id); 514 port_to_tab_id_map_.erase(port_id);
509 } 515 }
510 516
511 // static 517 // static
512 std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() { 518 std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() {
513 std::vector<std::pair<std::string, int> > resources; 519 std::vector<std::pair<std::string, int> > resources;
514 520
515 // Libraries. 521 // Libraries.
522 resources.push_back(std::make_pair("appView", IDR_APP_VIEW_JS));
523 resources.push_back(std::make_pair("denyAppView", IDR_APP_VIEW_DENY_JS));
516 resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER)); 524 resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER));
517 resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS)); 525 resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS));
518 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS)); 526 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
519 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS)); 527 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS));
520 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS)); 528 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS));
521 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS)); 529 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS));
522 resources.push_back( 530 resources.push_back(
523 std::make_pair("messaging_utils", IDR_MESSAGING_UTILS_JS)); 531 std::make_pair("messaging_utils", IDR_MESSAGING_UTILS_JS));
524 resources.push_back(std::make_pair(kSchemaUtils, IDR_SCHEMA_UTILS_JS)); 532 resources.push_back(std::make_pair(kSchemaUtils, IDR_SCHEMA_UTILS_JS));
525 resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS)); 533 resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS));
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 return v8::Handle<v8::Object>(); 1384 return v8::Handle<v8::Object>();
1377 1385
1378 if (bind_name) 1386 if (bind_name)
1379 *bind_name = split.back(); 1387 *bind_name = split.back();
1380 1388
1381 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1389 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1382 : bind_object; 1390 : bind_object;
1383 } 1391 }
1384 1392
1385 } // namespace extensions 1393 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698