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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "extensions/renderer/script_context.h" | 68 #include "extensions/renderer/script_context.h" |
69 #include "extensions/renderer/script_context_set.h" | 69 #include "extensions/renderer/script_context_set.h" |
70 #include "extensions/renderer/script_injection.h" | 70 #include "extensions/renderer/script_injection.h" |
71 #include "extensions/renderer/script_injection_manager.h" | 71 #include "extensions/renderer/script_injection_manager.h" |
72 #include "extensions/renderer/send_request_natives.h" | 72 #include "extensions/renderer/send_request_natives.h" |
73 #include "extensions/renderer/set_icon_natives.h" | 73 #include "extensions/renderer/set_icon_natives.h" |
74 #include "extensions/renderer/test_features_native_handler.h" | 74 #include "extensions/renderer/test_features_native_handler.h" |
75 #include "extensions/renderer/user_gestures_native_handler.h" | 75 #include "extensions/renderer/user_gestures_native_handler.h" |
76 #include "extensions/renderer/utils_native_handler.h" | 76 #include "extensions/renderer/utils_native_handler.h" |
77 #include "extensions/renderer/v8_context_native_handler.h" | 77 #include "extensions/renderer/v8_context_native_handler.h" |
| 78 #include "grit/content_resources.h" |
78 #include "grit/extensions_renderer_resources.h" | 79 #include "grit/extensions_renderer_resources.h" |
| 80 #include "mojo/public/js/bindings/constants.h" |
79 #include "third_party/WebKit/public/platform/WebString.h" | 81 #include "third_party/WebKit/public/platform/WebString.h" |
80 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 82 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
81 #include "third_party/WebKit/public/web/WebCustomElement.h" | 83 #include "third_party/WebKit/public/web/WebCustomElement.h" |
82 #include "third_party/WebKit/public/web/WebDataSource.h" | 84 #include "third_party/WebKit/public/web/WebDataSource.h" |
83 #include "third_party/WebKit/public/web/WebDocument.h" | 85 #include "third_party/WebKit/public/web/WebDocument.h" |
84 #include "third_party/WebKit/public/web/WebFrame.h" | 86 #include "third_party/WebKit/public/web/WebFrame.h" |
85 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 87 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
86 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 88 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
87 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 89 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
88 #include "third_party/WebKit/public/web/WebView.h" | 90 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 } | 452 } |
451 } | 453 } |
452 | 454 |
453 void Dispatcher::ClearPortData(int port_id) { | 455 void Dispatcher::ClearPortData(int port_id) { |
454 // Only the target port side has entries in |port_to_tab_id_map_|. If | 456 // Only the target port side has entries in |port_to_tab_id_map_|. If |
455 // |port_id| is a source port, std::map::erase() will just silently fail | 457 // |port_id| is a source port, std::map::erase() will just silently fail |
456 // here as a no-op. | 458 // here as a no-op. |
457 port_to_tab_id_map_.erase(port_id); | 459 port_to_tab_id_map_.erase(port_id); |
458 } | 460 } |
459 | 461 |
| 462 // static |
| 463 std::vector<std::pair<std::string, int> > Dispatcher::GetJsResources() { |
| 464 std::vector<std::pair<std::string, int> > resources; |
| 465 |
| 466 // Libraries. |
| 467 resources.push_back(std::make_pair("entryIdManager", IDR_ENTRY_ID_MANAGER)); |
| 468 resources.push_back(std::make_pair(kEventBindings, IDR_EVENT_BINDINGS_JS)); |
| 469 resources.push_back(std::make_pair("imageUtil", IDR_IMAGE_UTIL_JS)); |
| 470 resources.push_back(std::make_pair("json_schema", IDR_JSON_SCHEMA_JS)); |
| 471 resources.push_back(std::make_pair("lastError", IDR_LAST_ERROR_JS)); |
| 472 resources.push_back(std::make_pair("messaging", IDR_MESSAGING_JS)); |
| 473 resources.push_back( |
| 474 std::make_pair("messaging_utils", IDR_MESSAGING_UTILS_JS)); |
| 475 resources.push_back(std::make_pair(kSchemaUtils, IDR_SCHEMA_UTILS_JS)); |
| 476 resources.push_back(std::make_pair("sendRequest", IDR_SEND_REQUEST_JS)); |
| 477 resources.push_back(std::make_pair("setIcon", IDR_SET_ICON_JS)); |
| 478 resources.push_back(std::make_pair("test", IDR_TEST_CUSTOM_BINDINGS_JS)); |
| 479 resources.push_back( |
| 480 std::make_pair("test_environment_specific_bindings", |
| 481 IDR_BROWSER_TEST_ENVIRONMENT_SPECIFIC_BINDINGS_JS)); |
| 482 resources.push_back(std::make_pair("uncaught_exception_handler", |
| 483 IDR_UNCAUGHT_EXCEPTION_HANDLER_JS)); |
| 484 resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS)); |
| 485 resources.push_back(std::make_pair("utils", IDR_UTILS_JS)); |
| 486 resources.push_back( |
| 487 std::make_pair(mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS)); |
| 488 resources.push_back( |
| 489 std::make_pair(mojo::kCodecModuleName, IDR_MOJO_CODEC_JS)); |
| 490 resources.push_back( |
| 491 std::make_pair(mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS)); |
| 492 resources.push_back( |
| 493 std::make_pair(mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS)); |
| 494 resources.push_back( |
| 495 std::make_pair(mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS)); |
| 496 resources.push_back( |
| 497 std::make_pair(mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS)); |
| 498 |
| 499 // Custom bindings. |
| 500 resources.push_back( |
| 501 std::make_pair("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS)); |
| 502 resources.push_back( |
| 503 std::make_pair("contextMenus", IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS)); |
| 504 resources.push_back( |
| 505 std::make_pair("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS)); |
| 506 resources.push_back(std::make_pair("i18n", IDR_I18N_CUSTOM_BINDINGS_JS)); |
| 507 resources.push_back( |
| 508 std::make_pair("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS)); |
| 509 resources.push_back( |
| 510 std::make_pair("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS)); |
| 511 resources.push_back(std::make_pair("binding", IDR_BINDING_JS)); |
| 512 |
| 513 // Custom types sources. |
| 514 resources.push_back(std::make_pair("StorageArea", IDR_STORAGE_AREA_JS)); |
| 515 |
| 516 // Platform app sources that are not API-specific.. |
| 517 resources.push_back(std::make_pair("platformApp", IDR_PLATFORM_APP_JS)); |
| 518 |
| 519 return resources; |
| 520 } |
| 521 |
| 522 // NOTE: please use the naming convention "foo_natives" for these. |
| 523 // static |
| 524 void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, |
| 525 ScriptContext* context, |
| 526 Dispatcher* dispatcher, |
| 527 RequestSender* request_sender, |
| 528 V8SchemaRegistry* v8_schema_registry) { |
| 529 module_system->RegisterNativeHandler( |
| 530 "chrome", scoped_ptr<NativeHandler>(new ChromeNativeHandler(context))); |
| 531 module_system->RegisterNativeHandler( |
| 532 "lazy_background_page", |
| 533 scoped_ptr<NativeHandler>(new LazyBackgroundPageNativeHandler(context))); |
| 534 module_system->RegisterNativeHandler( |
| 535 "logging", scoped_ptr<NativeHandler>(new LoggingNativeHandler(context))); |
| 536 module_system->RegisterNativeHandler("schema_registry", |
| 537 v8_schema_registry->AsNativeHandler()); |
| 538 module_system->RegisterNativeHandler( |
| 539 "print", scoped_ptr<NativeHandler>(new PrintNativeHandler(context))); |
| 540 module_system->RegisterNativeHandler( |
| 541 "test_features", |
| 542 scoped_ptr<NativeHandler>(new TestFeaturesNativeHandler(context))); |
| 543 module_system->RegisterNativeHandler( |
| 544 "user_gestures", |
| 545 scoped_ptr<NativeHandler>(new UserGesturesNativeHandler(context))); |
| 546 module_system->RegisterNativeHandler( |
| 547 "utils", scoped_ptr<NativeHandler>(new UtilsNativeHandler(context))); |
| 548 module_system->RegisterNativeHandler( |
| 549 "v8_context", |
| 550 scoped_ptr<NativeHandler>( |
| 551 new V8ContextNativeHandler(context, dispatcher))); |
| 552 module_system->RegisterNativeHandler( |
| 553 "event_natives", |
| 554 scoped_ptr<NativeHandler>(new EventBindings(dispatcher, context))); |
| 555 module_system->RegisterNativeHandler( |
| 556 "messaging_natives", |
| 557 scoped_ptr<NativeHandler>(MessagingBindings::Get(dispatcher, context))); |
| 558 module_system->RegisterNativeHandler( |
| 559 "apiDefinitions", |
| 560 scoped_ptr<NativeHandler>( |
| 561 new ApiDefinitionsNatives(dispatcher, context))); |
| 562 module_system->RegisterNativeHandler( |
| 563 "sendRequest", |
| 564 scoped_ptr<NativeHandler>( |
| 565 new SendRequestNatives(request_sender, context))); |
| 566 module_system->RegisterNativeHandler( |
| 567 "setIcon", |
| 568 scoped_ptr<NativeHandler>(new SetIconNatives(request_sender, context))); |
| 569 module_system->RegisterNativeHandler( |
| 570 "activityLogger", |
| 571 scoped_ptr<NativeHandler>(new APIActivityLogger(context))); |
| 572 module_system->RegisterNativeHandler( |
| 573 "renderViewObserverNatives", |
| 574 scoped_ptr<NativeHandler>(new RenderViewObserverNatives(context))); |
| 575 |
| 576 // Natives used by multiple APIs. |
| 577 module_system->RegisterNativeHandler( |
| 578 "file_system_natives", |
| 579 scoped_ptr<NativeHandler>(new FileSystemNatives(context))); |
| 580 |
| 581 // Custom bindings. |
| 582 module_system->RegisterNativeHandler( |
| 583 "app_runtime", |
| 584 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings(context))); |
| 585 module_system->RegisterNativeHandler( |
| 586 "blob_natives", |
| 587 scoped_ptr<NativeHandler>(new BlobNativeHandler(context))); |
| 588 module_system->RegisterNativeHandler( |
| 589 "context_menus", |
| 590 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings(context))); |
| 591 module_system->RegisterNativeHandler( |
| 592 "css_natives", scoped_ptr<NativeHandler>(new CssNativeHandler(context))); |
| 593 module_system->RegisterNativeHandler( |
| 594 "document_natives", |
| 595 scoped_ptr<NativeHandler>(new DocumentCustomBindings(context))); |
| 596 module_system->RegisterNativeHandler( |
| 597 "i18n", scoped_ptr<NativeHandler>(new I18NCustomBindings(context))); |
| 598 module_system->RegisterNativeHandler( |
| 599 "id_generator", |
| 600 scoped_ptr<NativeHandler>(new IdGeneratorCustomBindings(context))); |
| 601 module_system->RegisterNativeHandler( |
| 602 "runtime", scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
| 603 } |
| 604 |
460 bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { | 605 bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) { |
461 bool handled = true; | 606 bool handled = true; |
462 IPC_BEGIN_MESSAGE_MAP(Dispatcher, message) | 607 IPC_BEGIN_MESSAGE_MAP(Dispatcher, message) |
463 IPC_MESSAGE_HANDLER(ExtensionMsg_ActivateExtension, OnActivateExtension) | 608 IPC_MESSAGE_HANDLER(ExtensionMsg_ActivateExtension, OnActivateExtension) |
464 IPC_MESSAGE_HANDLER(ExtensionMsg_CancelSuspend, OnCancelSuspend) | 609 IPC_MESSAGE_HANDLER(ExtensionMsg_CancelSuspend, OnCancelSuspend) |
465 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, | 610 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, |
466 OnClearTabSpecificPermissions) | 611 OnClearTabSpecificPermissions) |
467 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnDeliverMessage) | 612 IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnDeliverMessage) |
468 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, OnDispatchOnConnect) | 613 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, OnDispatchOnConnect) |
469 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, OnDispatchOnDisconnect) | 614 IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, OnDispatchOnDisconnect) |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 module_system->SetNativeLazyField( | 1100 module_system->SetNativeLazyField( |
956 bind_object, bind_name, api_name, "binding"); | 1101 bind_object, bind_name, api_name, "binding"); |
957 } else { | 1102 } else { |
958 module_system->SetLazyField(bind_object, bind_name, api_name, "binding"); | 1103 module_system->SetLazyField(bind_object, bind_name, api_name, "binding"); |
959 } | 1104 } |
960 } | 1105 } |
961 | 1106 |
962 // NOTE: please use the naming convention "foo_natives" for these. | 1107 // NOTE: please use the naming convention "foo_natives" for these. |
963 void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, | 1108 void Dispatcher::RegisterNativeHandlers(ModuleSystem* module_system, |
964 ScriptContext* context) { | 1109 ScriptContext* context) { |
965 module_system->RegisterNativeHandler( | 1110 RegisterNativeHandlers(module_system, |
966 "chrome", scoped_ptr<NativeHandler>(new ChromeNativeHandler(context))); | 1111 context, |
967 module_system->RegisterNativeHandler( | 1112 this, |
968 "lazy_background_page", | 1113 request_sender_.get(), |
969 scoped_ptr<NativeHandler>(new LazyBackgroundPageNativeHandler(context))); | 1114 v8_schema_registry_.get()); |
970 module_system->RegisterNativeHandler( | |
971 "logging", scoped_ptr<NativeHandler>(new LoggingNativeHandler(context))); | |
972 module_system->RegisterNativeHandler("schema_registry", | |
973 v8_schema_registry_->AsNativeHandler()); | |
974 module_system->RegisterNativeHandler( | |
975 "print", scoped_ptr<NativeHandler>(new PrintNativeHandler(context))); | |
976 module_system->RegisterNativeHandler( | |
977 "test_features", | |
978 scoped_ptr<NativeHandler>(new TestFeaturesNativeHandler(context))); | |
979 module_system->RegisterNativeHandler( | |
980 "user_gestures", | |
981 scoped_ptr<NativeHandler>(new UserGesturesNativeHandler(context))); | |
982 module_system->RegisterNativeHandler( | |
983 "utils", scoped_ptr<NativeHandler>(new UtilsNativeHandler(context))); | |
984 module_system->RegisterNativeHandler( | |
985 "v8_context", | |
986 scoped_ptr<NativeHandler>(new V8ContextNativeHandler(context, this))); | |
987 | |
988 const Extension* extension = context->extension(); | 1115 const Extension* extension = context->extension(); |
989 int manifest_version = extension ? extension->manifest_version() : 1; | 1116 int manifest_version = extension ? extension->manifest_version() : 1; |
990 bool send_request_disabled = | 1117 bool send_request_disabled = |
991 (extension && Manifest::IsUnpackedLocation(extension->location()) && | 1118 (extension && Manifest::IsUnpackedLocation(extension->location()) && |
992 BackgroundInfo::HasLazyBackgroundPage(extension)); | 1119 BackgroundInfo::HasLazyBackgroundPage(extension)); |
993 module_system->RegisterNativeHandler( | 1120 module_system->RegisterNativeHandler( |
994 "process", | 1121 "process", |
995 scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler( | 1122 scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler( |
996 context, | 1123 context, |
997 context->GetExtensionID(), | 1124 context->GetExtensionID(), |
998 context->GetContextTypeDescription(), | 1125 context->GetContextTypeDescription(), |
999 ExtensionsRendererClient::Get()->IsIncognitoProcess(), | 1126 ExtensionsRendererClient::Get()->IsIncognitoProcess(), |
1000 manifest_version, | 1127 manifest_version, |
1001 send_request_disabled))); | 1128 send_request_disabled))); |
1002 | 1129 |
1003 module_system->RegisterNativeHandler( | |
1004 "event_natives", | |
1005 scoped_ptr<NativeHandler>(new EventBindings(this, context))); | |
1006 module_system->RegisterNativeHandler( | |
1007 "messaging_natives", | |
1008 scoped_ptr<NativeHandler>(MessagingBindings::Get(this, context))); | |
1009 module_system->RegisterNativeHandler( | |
1010 "apiDefinitions", | |
1011 scoped_ptr<NativeHandler>(new ApiDefinitionsNatives(this, context))); | |
1012 module_system->RegisterNativeHandler( | |
1013 "sendRequest", | |
1014 scoped_ptr<NativeHandler>( | |
1015 new SendRequestNatives(request_sender_.get(), context))); | |
1016 module_system->RegisterNativeHandler( | |
1017 "setIcon", | |
1018 scoped_ptr<NativeHandler>( | |
1019 new SetIconNatives(request_sender_.get(), context))); | |
1020 module_system->RegisterNativeHandler( | |
1021 "activityLogger", | |
1022 scoped_ptr<NativeHandler>(new APIActivityLogger(context))); | |
1023 module_system->RegisterNativeHandler( | |
1024 "renderViewObserverNatives", | |
1025 scoped_ptr<NativeHandler>(new RenderViewObserverNatives(context))); | |
1026 | |
1027 // Natives used by multiple APIs. | |
1028 module_system->RegisterNativeHandler( | |
1029 "file_system_natives", | |
1030 scoped_ptr<NativeHandler>(new FileSystemNatives(context))); | |
1031 | |
1032 // Custom bindings. | |
1033 module_system->RegisterNativeHandler( | |
1034 "app_runtime", | |
1035 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings(context))); | |
1036 module_system->RegisterNativeHandler( | |
1037 "blob_natives", | |
1038 scoped_ptr<NativeHandler>(new BlobNativeHandler(context))); | |
1039 module_system->RegisterNativeHandler( | |
1040 "context_menus", | |
1041 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings(context))); | |
1042 module_system->RegisterNativeHandler( | |
1043 "css_natives", scoped_ptr<NativeHandler>(new CssNativeHandler(context))); | |
1044 module_system->RegisterNativeHandler( | |
1045 "document_natives", | |
1046 scoped_ptr<NativeHandler>(new DocumentCustomBindings(context))); | |
1047 module_system->RegisterNativeHandler( | |
1048 "i18n", scoped_ptr<NativeHandler>(new I18NCustomBindings(context))); | |
1049 module_system->RegisterNativeHandler( | |
1050 "id_generator", | |
1051 scoped_ptr<NativeHandler>(new IdGeneratorCustomBindings(context))); | |
1052 module_system->RegisterNativeHandler( | |
1053 "runtime", scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); | |
1054 | |
1055 delegate_->RegisterNativeHandlers(this, module_system, context); | 1130 delegate_->RegisterNativeHandlers(this, module_system, context); |
1056 } | 1131 } |
1057 | 1132 |
1058 void Dispatcher::PopulateSourceMap() { | 1133 void Dispatcher::PopulateSourceMap() { |
1059 // Libraries. | 1134 const std::vector<std::pair<std::string, int> > resources = GetJsResources(); |
1060 source_map_.RegisterSource("entryIdManager", IDR_ENTRY_ID_MANAGER); | 1135 for (std::vector<std::pair<std::string, int> >::const_iterator resource = |
1061 source_map_.RegisterSource(kEventBindings, IDR_EVENT_BINDINGS_JS); | 1136 resources.begin(); |
1062 source_map_.RegisterSource("imageUtil", IDR_IMAGE_UTIL_JS); | 1137 resource != resources.end(); |
1063 source_map_.RegisterSource("json_schema", IDR_JSON_SCHEMA_JS); | 1138 ++resource) { |
1064 source_map_.RegisterSource("lastError", IDR_LAST_ERROR_JS); | 1139 source_map_.RegisterSource(resource->first, resource->second); |
1065 source_map_.RegisterSource("messaging", IDR_MESSAGING_JS); | 1140 } |
1066 source_map_.RegisterSource("messaging_utils", IDR_MESSAGING_UTILS_JS); | |
1067 source_map_.RegisterSource(kSchemaUtils, IDR_SCHEMA_UTILS_JS); | |
1068 source_map_.RegisterSource("sendRequest", IDR_SEND_REQUEST_JS); | |
1069 source_map_.RegisterSource("setIcon", IDR_SET_ICON_JS); | |
1070 source_map_.RegisterSource("test", IDR_TEST_CUSTOM_BINDINGS_JS); | |
1071 source_map_.RegisterSource("uncaught_exception_handler", | |
1072 IDR_UNCAUGHT_EXCEPTION_HANDLER_JS); | |
1073 source_map_.RegisterSource("unload_event", IDR_UNLOAD_EVENT_JS); | |
1074 source_map_.RegisterSource("utils", IDR_UTILS_JS); | |
1075 | |
1076 // Custom bindings. | |
1077 source_map_.RegisterSource("app.runtime", IDR_APP_RUNTIME_CUSTOM_BINDINGS_JS); | |
1078 source_map_.RegisterSource("contextMenus", | |
1079 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); | |
1080 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); | |
1081 source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS); | |
1082 source_map_.RegisterSource("permissions", IDR_PERMISSIONS_CUSTOM_BINDINGS_JS); | |
1083 source_map_.RegisterSource("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS); | |
1084 source_map_.RegisterSource("binding", IDR_BINDING_JS); | |
1085 | |
1086 // Custom types sources. | |
1087 source_map_.RegisterSource("StorageArea", IDR_STORAGE_AREA_JS); | |
1088 | |
1089 // Platform app sources that are not API-specific.. | |
1090 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); | |
1091 | |
1092 delegate_->PopulateSourceMap(&source_map_); | 1141 delegate_->PopulateSourceMap(&source_map_); |
1093 } | 1142 } |
1094 | 1143 |
1095 bool Dispatcher::IsWithinPlatformApp() { | 1144 bool Dispatcher::IsWithinPlatformApp() { |
1096 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); | 1145 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); |
1097 iter != active_extension_ids_.end(); | 1146 iter != active_extension_ids_.end(); |
1098 ++iter) { | 1147 ++iter) { |
1099 const Extension* extension = extensions_.GetByID(*iter); | 1148 const Extension* extension = extensions_.GetByID(*iter); |
1100 if (extension && extension->is_platform_app()) | 1149 if (extension && extension->is_platform_app()) |
1101 return true; | 1150 return true; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 return v8::Handle<v8::Object>(); | 1284 return v8::Handle<v8::Object>(); |
1236 | 1285 |
1237 if (bind_name) | 1286 if (bind_name) |
1238 *bind_name = split.back(); | 1287 *bind_name = split.back(); |
1239 | 1288 |
1240 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1289 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1241 : bind_object; | 1290 : bind_object; |
1242 } | 1291 } |
1243 | 1292 |
1244 } // namespace extensions | 1293 } // namespace extensions |
OLD | NEW |