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

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

Powered by Google App Engine
This is Rietveld 408576698