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

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

Issue 652313002: Enable the mojo-based serial API in the renderer behind a flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-js-natives-registration
Patch Set: rebase 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 resources.push_back( 564 resources.push_back(
565 std::make_pair(mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS)); 565 std::make_pair(mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS));
566 resources.push_back( 566 resources.push_back(
567 std::make_pair(mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS)); 567 std::make_pair(mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS));
568 resources.push_back( 568 resources.push_back(
569 std::make_pair(mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS)); 569 std::make_pair(mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS));
570 resources.push_back( 570 resources.push_back(
571 std::make_pair(mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS)); 571 std::make_pair(mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS));
572 resources.push_back( 572 resources.push_back(
573 std::make_pair(mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS)); 573 std::make_pair(mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS));
574 resources.push_back(std::make_pair("async_waiter", IDR_ASYNC_WAITER_JS));
575 resources.push_back(std::make_pair("data_receiver", IDR_DATA_RECEIVER_JS));
576 resources.push_back(std::make_pair("data_sender", IDR_DATA_SENDER_JS));
577 resources.push_back(std::make_pair("device/serial/data_stream.mojom",
578 IDR_DATA_STREAM_MOJOM_JS));
579 resources.push_back(
580 std::make_pair("device/serial/data_stream_serialization.mojom",
581 IDR_DATA_STREAM_SERIALIZATION_MOJOM_JS));
574 582
575 // Custom bindings. 583 // Custom bindings.
576 resources.push_back( 584 resources.push_back(
577 std::make_pair("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS)); 585 std::make_pair("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS));
578 resources.push_back( 586 resources.push_back(
579 std::make_pair("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS)); 587 std::make_pair("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS));
580 resources.push_back( 588 resources.push_back(
581 std::make_pair("declarativeWebRequest", 589 std::make_pair("declarativeWebRequest",
582 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS)); 590 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS));
583 resources.push_back( 591 resources.push_back(
584 std::make_pair("contextMenus", IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS)); 592 std::make_pair("contextMenus", IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS));
585 resources.push_back( 593 resources.push_back(
586 std::make_pair("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS)); 594 std::make_pair("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS));
587 resources.push_back(std::make_pair("i18n", IDR_I18N_CUSTOM_BINDINGS_JS)); 595 resources.push_back(std::make_pair("i18n", IDR_I18N_CUSTOM_BINDINGS_JS));
588 resources.push_back( 596 resources.push_back(
589 std::make_pair("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS)); 597 std::make_pair("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS));
590 resources.push_back( 598 resources.push_back(
591 std::make_pair("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS)); 599 std::make_pair("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS));
592 resources.push_back(std::make_pair("windowControls", IDR_WINDOW_CONTROLS_JS)); 600 resources.push_back(std::make_pair("windowControls", IDR_WINDOW_CONTROLS_JS));
593 resources.push_back( 601 resources.push_back(
594 std::make_pair("webViewRequest", 602 std::make_pair("webViewRequest",
595 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS)); 603 IDR_WEB_VIEW_REQUEST_CUSTOM_BINDINGS_JS));
596 resources.push_back(std::make_pair("binding", IDR_BINDING_JS)); 604 resources.push_back(std::make_pair("binding", IDR_BINDING_JS));
597 605
606 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
607 switches::kEnableMojoSerialService)) {
608 resources.push_back(
609 std::make_pair("serial", IDR_SERIAL_CUSTOM_BINDINGS_JS));
610 }
611 resources.push_back(std::make_pair("serial_service", IDR_SERIAL_SERVICE_JS));
612 resources.push_back(
613 std::make_pair("device/serial/serial.mojom", IDR_SERIAL_MOJOM_JS));
614 resources.push_back(std::make_pair("device/serial/serial_serialization.mojom",
615 IDR_SERIAL_SERIALIZATION_MOJOM_JS));
616
598 // Custom types sources. 617 // Custom types sources.
599 resources.push_back(std::make_pair("StorageArea", IDR_STORAGE_AREA_JS)); 618 resources.push_back(std::make_pair("StorageArea", IDR_STORAGE_AREA_JS));
600 619
601 // Platform app sources that are not API-specific.. 620 // Platform app sources that are not API-specific..
602 resources.push_back(std::make_pair("platformApp", IDR_PLATFORM_APP_JS)); 621 resources.push_back(std::make_pair("platformApp", IDR_PLATFORM_APP_JS));
603 622
604 return resources; 623 return resources;
605 } 624 }
606 625
607 // NOTE: please use the naming convention "foo_natives" for these. 626 // NOTE: please use the naming convention "foo_natives" for these.
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 return v8::Handle<v8::Object>(); 1406 return v8::Handle<v8::Object>();
1388 1407
1389 if (bind_name) 1408 if (bind_name)
1390 *bind_name = split.back(); 1409 *bind_name = split.back();
1391 1410
1392 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1411 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1393 : bind_object; 1412 : bind_object;
1394 } 1413 }
1395 1414
1396 } // namespace extensions 1415 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698