OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "chrome/renderer/extensions/render_view_observer_natives.h" | 61 #include "chrome/renderer/extensions/render_view_observer_natives.h" |
62 #include "chrome/renderer/extensions/request_sender.h" | 62 #include "chrome/renderer/extensions/request_sender.h" |
63 #include "chrome/renderer/extensions/runtime_custom_bindings.h" | 63 #include "chrome/renderer/extensions/runtime_custom_bindings.h" |
64 #include "chrome/renderer/extensions/safe_builtins.h" | 64 #include "chrome/renderer/extensions/safe_builtins.h" |
65 #include "chrome/renderer/extensions/send_request_natives.h" | 65 #include "chrome/renderer/extensions/send_request_natives.h" |
66 #include "chrome/renderer/extensions/set_icon_natives.h" | 66 #include "chrome/renderer/extensions/set_icon_natives.h" |
67 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" | 67 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" |
68 #include "chrome/renderer/extensions/tab_finder.h" | 68 #include "chrome/renderer/extensions/tab_finder.h" |
69 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 69 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
70 #include "chrome/renderer/extensions/user_script_slave.h" | 70 #include "chrome/renderer/extensions/user_script_slave.h" |
71 #include "chrome/renderer/extensions/webrtc_native_handler.h" | |
72 #include "chrome/renderer/extensions/webstore_bindings.h" | 71 #include "chrome/renderer/extensions/webstore_bindings.h" |
73 #include "chrome/renderer/resource_bundle_source_map.h" | 72 #include "chrome/renderer/resource_bundle_source_map.h" |
74 #include "content/public/renderer/render_thread.h" | 73 #include "content/public/renderer/render_thread.h" |
75 #include "content/public/renderer/render_view.h" | 74 #include "content/public/renderer/render_view.h" |
76 #include "content/public/renderer/v8_value_converter.h" | 75 #include "content/public/renderer/v8_value_converter.h" |
77 #include "extensions/common/constants.h" | 76 #include "extensions/common/constants.h" |
78 #include "extensions/common/extension_api.h" | 77 #include "extensions/common/extension_api.h" |
79 #include "extensions/common/extension_urls.h" | 78 #include "extensions/common/extension_urls.h" |
80 #include "extensions/common/features/feature.h" | 79 #include "extensions/common/features/feature.h" |
81 #include "extensions/common/features/feature_provider.h" | 80 #include "extensions/common/features/feature_provider.h" |
(...skipping 11 matching lines...) Expand all Loading... |
93 #include "third_party/WebKit/public/web/WebFrame.h" | 92 #include "third_party/WebKit/public/web/WebFrame.h" |
94 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 93 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
95 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 94 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
96 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 95 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
97 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 96 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
98 #include "third_party/WebKit/public/web/WebView.h" | 97 #include "third_party/WebKit/public/web/WebView.h" |
99 #include "ui/base/layout.h" | 98 #include "ui/base/layout.h" |
100 #include "ui/base/resource/resource_bundle.h" | 99 #include "ui/base/resource/resource_bundle.h" |
101 #include "v8/include/v8.h" | 100 #include "v8/include/v8.h" |
102 | 101 |
| 102 #if defined(ENABLE_WEBRTC) |
| 103 #include "chrome/renderer/extensions/webrtc_native_handler.h" |
| 104 #endif |
| 105 |
103 using WebKit::WebDataSource; | 106 using WebKit::WebDataSource; |
104 using WebKit::WebDocument; | 107 using WebKit::WebDocument; |
105 using WebKit::WebFrame; | 108 using WebKit::WebFrame; |
106 using WebKit::WebScopedUserGesture; | 109 using WebKit::WebScopedUserGesture; |
107 using WebKit::WebSecurityPolicy; | 110 using WebKit::WebSecurityPolicy; |
108 using WebKit::WebString; | 111 using WebKit::WebString; |
109 using WebKit::WebVector; | 112 using WebKit::WebVector; |
110 using WebKit::WebView; | 113 using WebKit::WebView; |
111 using content::RenderThread; | 114 using content::RenderThread; |
112 using content::RenderView; | 115 using content::RenderView; |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 new PageActionsCustomBindings(this, context))); | 934 new PageActionsCustomBindings(this, context))); |
932 module_system->RegisterNativeHandler("page_capture", | 935 module_system->RegisterNativeHandler("page_capture", |
933 scoped_ptr<NativeHandler>( | 936 scoped_ptr<NativeHandler>( |
934 new PageCaptureCustomBindings(this, context))); | 937 new PageCaptureCustomBindings(this, context))); |
935 module_system->RegisterNativeHandler("runtime", | 938 module_system->RegisterNativeHandler("runtime", |
936 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(this, context))); | 939 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(this, context))); |
937 module_system->RegisterNativeHandler("tabs", | 940 module_system->RegisterNativeHandler("tabs", |
938 scoped_ptr<NativeHandler>(new TabsCustomBindings(this, context))); | 941 scoped_ptr<NativeHandler>(new TabsCustomBindings(this, context))); |
939 module_system->RegisterNativeHandler("webstore", | 942 module_system->RegisterNativeHandler("webstore", |
940 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); | 943 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); |
| 944 #if defined(ENABLE_WEBRTC) |
941 module_system->RegisterNativeHandler("webrtc_natives", | 945 module_system->RegisterNativeHandler("webrtc_natives", |
942 scoped_ptr<NativeHandler>(new WebRtcNativeHandler(context))); | 946 scoped_ptr<NativeHandler>(new WebRtcNativeHandler(context))); |
| 947 #endif |
943 } | 948 } |
944 | 949 |
945 void Dispatcher::PopulateSourceMap() { | 950 void Dispatcher::PopulateSourceMap() { |
946 // Libraries. | 951 // Libraries. |
947 source_map_.RegisterSource("entryIdManager", IDR_ENTRY_ID_MANAGER); | 952 source_map_.RegisterSource("entryIdManager", IDR_ENTRY_ID_MANAGER); |
948 source_map_.RegisterSource(kEventBindings, IDR_EVENT_BINDINGS_JS); | 953 source_map_.RegisterSource(kEventBindings, IDR_EVENT_BINDINGS_JS); |
949 source_map_.RegisterSource("imageUtil", IDR_IMAGE_UTIL_JS); | 954 source_map_.RegisterSource("imageUtil", IDR_IMAGE_UTIL_JS); |
950 source_map_.RegisterSource("json_schema", IDR_JSON_SCHEMA_JS); | 955 source_map_.RegisterSource("json_schema", IDR_JSON_SCHEMA_JS); |
951 source_map_.RegisterSource("lastError", IDR_LAST_ERROR_JS); | 956 source_map_.RegisterSource("lastError", IDR_LAST_ERROR_JS); |
952 source_map_.RegisterSource("messaging", IDR_MESSAGING_JS); | 957 source_map_.RegisterSource("messaging", IDR_MESSAGING_JS); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS); | 1009 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS); |
1005 source_map_.RegisterSource("systemIndicator", | 1010 source_map_.RegisterSource("systemIndicator", |
1006 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS); | 1011 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS); |
1007 source_map_.RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS); | 1012 source_map_.RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS); |
1008 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); | 1013 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); |
1009 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); | 1014 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); |
1010 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); | 1015 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); |
1011 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); | 1016 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); |
1012 source_map_.RegisterSource("webRequestInternal", | 1017 source_map_.RegisterSource("webRequestInternal", |
1013 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); | 1018 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); |
| 1019 #if defined(ENABLE_WEBRTC) |
1014 source_map_.RegisterSource("webrtc.castSendTransport", | 1020 source_map_.RegisterSource("webrtc.castSendTransport", |
1015 IDR_WEBRTC_CAST_SEND_TRANSPORT_CUSTOM_BINDINGS_JS); | 1021 IDR_WEBRTC_CAST_SEND_TRANSPORT_CUSTOM_BINDINGS_JS); |
1016 source_map_.RegisterSource("webrtc.castUdpTransport", | 1022 source_map_.RegisterSource("webrtc.castUdpTransport", |
1017 IDR_WEBRTC_CAST_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); | 1023 IDR_WEBRTC_CAST_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); |
| 1024 #endif |
1018 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 1025 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); |
1019 source_map_.RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); | 1026 source_map_.RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); |
1020 source_map_.RegisterSource("binding", IDR_BINDING_JS); | 1027 source_map_.RegisterSource("binding", IDR_BINDING_JS); |
1021 | 1028 |
1022 // Custom types sources. | 1029 // Custom types sources. |
1023 source_map_.RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 1030 source_map_.RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
1024 source_map_.RegisterSource("StorageArea", IDR_STORAGE_AREA_JS); | 1031 source_map_.RegisterSource("StorageArea", IDR_STORAGE_AREA_JS); |
1025 source_map_.RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 1032 source_map_.RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
1026 source_map_.RegisterSource("ChromeDirectSetting", | 1033 source_map_.RegisterSource("ChromeDirectSetting", |
1027 IDR_CHROME_DIRECT_SETTING_JS); | 1034 IDR_CHROME_DIRECT_SETTING_JS); |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 RenderView* background_view = | 1630 RenderView* background_view = |
1624 ExtensionHelper::GetBackgroundPage(extension_id); | 1631 ExtensionHelper::GetBackgroundPage(extension_id); |
1625 if (background_view) { | 1632 if (background_view) { |
1626 background_view->Send(new ExtensionHostMsg_EventAck( | 1633 background_view->Send(new ExtensionHostMsg_EventAck( |
1627 background_view->GetRoutingID())); | 1634 background_view->GetRoutingID())); |
1628 } | 1635 } |
1629 } | 1636 } |
1630 } | 1637 } |
1631 | 1638 |
1632 } // namespace extensions | 1639 } // namespace extensions |
OLD | NEW |