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