| Index: extensions/renderer/dispatcher.cc
|
| diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
|
| index fa242177fa2341141849ce945ff916f1a5f9a356..152b43ac42805c983916d45ea7262f84830787c1 100644
|
| --- a/extensions/renderer/dispatcher.cc
|
| +++ b/extensions/renderer/dispatcher.cc
|
| @@ -75,7 +75,9 @@
|
| #include "extensions/renderer/user_gestures_native_handler.h"
|
| #include "extensions/renderer/utils_native_handler.h"
|
| #include "extensions/renderer/v8_context_native_handler.h"
|
| +#include "grit/content_resources.h"
|
| #include "grit/extensions_renderer_resources.h"
|
| +#include "mojo/public/js/bindings/constants.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| #include "third_party/WebKit/public/platform/WebURLRequest.h"
|
| #include "third_party/WebKit/public/web/WebCustomElement.h"
|
| @@ -452,6 +454,63 @@ void Dispatcher::ClearPortData(int port_id) {
|
| port_to_tab_id_map_.erase(port_id);
|
| }
|
|
|
| +// static
|
| +std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() {
|
| + std::vector<std::pair<std::string, int> > resources;
|
| +
|
| + // Libraries.
|
| + resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER));
|
| + resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS));
|
| + resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS));
|
| + resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS));
|
| + resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS));
|
| + resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS));
|
| + resources.push_back(
|
| + std::make_pair("messaging_utils", IDR_MESSAGING_UTILS_JS));
|
| + resources.push_back(std::make_pair(kSchemaUtils, IDR_SCHEMA_UTILS_JS));
|
| + resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS));
|
| + resources.push_back(std::make_pair("setIcon", IDR_SET_ICON_JS));
|
| + resources.push_back(std::make_pair("test", IDR_TEST_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(
|
| + std::make_pair("test_delegate", IDR_TEST_CUSTOM_BINDINGS_DELEGATE_JS));
|
| + resources.push_back(std::make_pair("uncaught_exception_handler",
|
| + IDR_UNCAUGHT_EXCEPTION_HANDLER_JS));
|
| + resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS));
|
| + resources.push_back(std::make_pair("utils", IDR_UTILS_JS));
|
| + resources.push_back(
|
| + std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS));
|
| + resources.push_back(
|
| + std::make_pair(mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS));
|
| + resources.push_back(
|
| + std::make_pair(mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS));
|
| + resources.push_back(
|
| + std::make_pair(mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS));
|
| + resources.push_back(
|
| + std::make_pair(mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS));
|
| +
|
| + // Custom bindings.
|
| + resources.push_back(
|
| + std::make_pair("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(
|
| + std::make_pair("contextMenus", IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(
|
| + std::make_pair("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(std::make_pair("i18n", IDR_I18N_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(
|
| + std::make_pair("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(
|
| + std::make_pair("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS));
|
| + resources.push_back(std::make_pair("binding", IDR_BINDING_JS));
|
| +
|
| + // Custom types sources.
|
| + resources.push_back(std::make_pair("StorageArea", IDR_STORAGE_AREA_JS));
|
| +
|
| + // Platform app sources that are not API-specific..
|
| + resources.push_back(std::make_pair("platformApp", IDR_PLATFORM_APP_JS));
|
| +
|
| + return resources;
|
| +}
|
| +
|
| bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(Dispatcher, message)
|
| @@ -1021,39 +1080,13 @@ void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system,
|
| }
|
|
|
| void Dispatcher::PopulateSourceMap() {
|
| - // Libraries.
|
| - source_map_.RegisterSource("entryIdManager", IDR_ENTRY_ID_MANAGER);
|
| - source_map_.RegisterSource(kEventBindings, IDR_EVENT_BINDINGS_JS);
|
| - source_map_.RegisterSource("imageUtil", IDR_IMAGE_UTIL_JS);
|
| - source_map_.RegisterSource("json_schema", IDR_JSON_SCHEMA_JS);
|
| - source_map_.RegisterSource("lastError", IDR_LAST_ERROR_JS);
|
| - source_map_.RegisterSource("messaging", IDR_MESSAGING_JS);
|
| - source_map_.RegisterSource("messaging_utils", IDR_MESSAGING_UTILS_JS);
|
| - source_map_.RegisterSource(kSchemaUtils, IDR_SCHEMA_UTILS_JS);
|
| - source_map_.RegisterSource("sendRequest", IDR_SEND_REQUEST_JS);
|
| - source_map_.RegisterSource("setIcon", IDR_SET_ICON_JS);
|
| - source_map_.RegisterSource("test", IDR_TEST_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("uncaught_exception_handler",
|
| - IDR_UNCAUGHT_EXCEPTION_HANDLER_JS);
|
| - source_map_.RegisterSource("unload_event", IDR_UNLOAD_EVENT_JS);
|
| - source_map_.RegisterSource("utils", IDR_UTILS_JS);
|
| -
|
| - // Custom bindings.
|
| - source_map_.RegisterSource("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("contextMenus",
|
| - IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS);
|
| - source_map_.RegisterSource("binding", IDR_BINDING_JS);
|
| -
|
| - // Custom types sources.
|
| - source_map_.RegisterSource("StorageArea", IDR_STORAGE_AREA_JS);
|
| -
|
| - // Platform app sources that are not API-specific..
|
| - source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS);
|
| -
|
| + const std::vector<std::pair<std::string, int> > resources = GetJsResources();
|
| + for (std::vector<std::pair<std::string, int> >::const_iterator resource =
|
| + resources.begin();
|
| + resource != resources.end();
|
| + ++resource) {
|
| + source_map_.RegisterSource(resource->first, resource->second);
|
| + }
|
| delegate_->PopulateSourceMap(&source_map_);
|
| }
|
|
|
|
|