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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/chrome_version_info.h" | 11 #include "chrome/common/chrome_version_info.h" |
12 #include "chrome/common/crash_keys.h" | 12 #include "chrome/common/crash_keys.h" |
13 #include "chrome/common/extensions/features/feature_channel.h" | 13 #include "chrome/common/extensions/features/feature_channel.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "chrome/grit/renderer_resources.h" | 15 #include "chrome/grit/renderer_resources.h" |
16 #include "chrome/renderer/extensions/app_bindings.h" | 16 #include "chrome/renderer/extensions/app_bindings.h" |
17 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h" | 17 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h" |
18 #include "chrome/renderer/extensions/chrome_v8_context.h" | 18 #include "chrome/renderer/extensions/chrome_v8_context.h" |
19 #include "chrome/renderer/extensions/enterprise_platform_keys_natives.h" | |
20 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" | 19 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" |
21 #include "chrome/renderer/extensions/file_manager_private_custom_bindings.h" | 20 #include "chrome/renderer/extensions/file_manager_private_custom_bindings.h" |
22 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" | 21 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" |
23 #include "chrome/renderer/extensions/notifications_native_handler.h" | 22 #include "chrome/renderer/extensions/notifications_native_handler.h" |
24 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" | 23 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" |
| 24 #include "chrome/renderer/extensions/platform_keys_natives.h" |
25 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" | 25 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" |
26 #include "chrome/renderer/extensions/tab_finder.h" | 26 #include "chrome/renderer/extensions/tab_finder.h" |
27 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 27 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
28 #include "chrome/renderer/extensions/webstore_bindings.h" | 28 #include "chrome/renderer/extensions/webstore_bindings.h" |
29 #include "content/public/renderer/render_thread.h" | 29 #include "content/public/renderer/render_thread.h" |
30 #include "content/public/renderer/render_view.h" | 30 #include "content/public/renderer/render_view.h" |
31 #include "extensions/common/extension.h" | 31 #include "extensions/common/extension.h" |
32 #include "extensions/common/feature_switch.h" | 32 #include "extensions/common/feature_switch.h" |
33 #include "extensions/common/permissions/manifest_permission_set.h" | 33 #include "extensions/common/permissions/manifest_permission_set.h" |
34 #include "extensions/common/permissions/permission_set.h" | 34 #include "extensions/common/permissions/permission_set.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 extensions::ScriptContext* context) { | 93 extensions::ScriptContext* context) { |
94 module_system->RegisterNativeHandler( | 94 module_system->RegisterNativeHandler( |
95 "app", | 95 "app", |
96 scoped_ptr<NativeHandler>( | 96 scoped_ptr<NativeHandler>( |
97 new extensions::AppBindings(dispatcher, context))); | 97 new extensions::AppBindings(dispatcher, context))); |
98 module_system->RegisterNativeHandler( | 98 module_system->RegisterNativeHandler( |
99 "sync_file_system", | 99 "sync_file_system", |
100 scoped_ptr<NativeHandler>( | 100 scoped_ptr<NativeHandler>( |
101 new extensions::SyncFileSystemCustomBindings(context))); | 101 new extensions::SyncFileSystemCustomBindings(context))); |
102 module_system->RegisterNativeHandler( | 102 module_system->RegisterNativeHandler( |
103 "enterprise_platform_keys_natives", | |
104 scoped_ptr<NativeHandler>( | |
105 new extensions::EnterprisePlatformKeysNatives(context))); | |
106 module_system->RegisterNativeHandler( | |
107 "file_browser_handler", | 103 "file_browser_handler", |
108 scoped_ptr<NativeHandler>( | 104 scoped_ptr<NativeHandler>( |
109 new extensions::FileBrowserHandlerCustomBindings(context))); | 105 new extensions::FileBrowserHandlerCustomBindings(context))); |
110 module_system->RegisterNativeHandler( | 106 module_system->RegisterNativeHandler( |
111 "file_manager_private", | 107 "file_manager_private", |
112 scoped_ptr<NativeHandler>( | 108 scoped_ptr<NativeHandler>( |
113 new extensions::FileManagerPrivateCustomBindings(context))); | 109 new extensions::FileManagerPrivateCustomBindings(context))); |
114 module_system->RegisterNativeHandler( | 110 module_system->RegisterNativeHandler( |
115 "notifications_private", | 111 "notifications_private", |
116 scoped_ptr<NativeHandler>( | 112 scoped_ptr<NativeHandler>( |
117 new extensions::NotificationsNativeHandler(context))); | 113 new extensions::NotificationsNativeHandler(context))); |
118 module_system->RegisterNativeHandler( | 114 module_system->RegisterNativeHandler( |
119 "mediaGalleries", | 115 "mediaGalleries", |
120 scoped_ptr<NativeHandler>( | 116 scoped_ptr<NativeHandler>( |
121 new extensions::MediaGalleriesCustomBindings(context))); | 117 new extensions::MediaGalleriesCustomBindings(context))); |
122 module_system->RegisterNativeHandler( | 118 module_system->RegisterNativeHandler( |
123 "page_capture", | 119 "page_capture", |
124 scoped_ptr<NativeHandler>( | 120 scoped_ptr<NativeHandler>( |
125 new extensions::PageCaptureCustomBindings(context))); | 121 new extensions::PageCaptureCustomBindings(context))); |
126 module_system->RegisterNativeHandler( | 122 module_system->RegisterNativeHandler( |
| 123 "platform_keys_natives", |
| 124 scoped_ptr<NativeHandler>(new extensions::PlatformKeysNatives(context))); |
| 125 module_system->RegisterNativeHandler( |
127 "tabs", | 126 "tabs", |
128 scoped_ptr<NativeHandler>(new extensions::TabsCustomBindings(context))); | 127 scoped_ptr<NativeHandler>(new extensions::TabsCustomBindings(context))); |
129 module_system->RegisterNativeHandler( | 128 module_system->RegisterNativeHandler( |
130 "webstore", | 129 "webstore", |
131 scoped_ptr<NativeHandler>(new extensions::WebstoreBindings(context))); | 130 scoped_ptr<NativeHandler>(new extensions::WebstoreBindings(context))); |
132 #if defined(ENABLE_WEBRTC) | 131 #if defined(ENABLE_WEBRTC) |
133 module_system->RegisterNativeHandler( | 132 module_system->RegisterNativeHandler( |
134 "cast_streaming_natives", | 133 "cast_streaming_natives", |
135 scoped_ptr<NativeHandler>( | 134 scoped_ptr<NativeHandler>( |
136 new extensions::CastStreamingNativeHandler(context))); | 135 new extensions::CastStreamingNativeHandler(context))); |
(...skipping 17 matching lines...) Expand all Loading... |
154 IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS); | 153 IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS); |
155 source_map->RegisterSource("desktopCapture", | 154 source_map->RegisterSource("desktopCapture", |
156 IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS); | 155 IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS); |
157 source_map->RegisterSource("developerPrivate", | 156 source_map->RegisterSource("developerPrivate", |
158 IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS); | 157 IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS); |
159 source_map->RegisterSource("downloads", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS); | 158 source_map->RegisterSource("downloads", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS); |
160 source_map->RegisterSource("enterprise.platformKeys", | 159 source_map->RegisterSource("enterprise.platformKeys", |
161 IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS); | 160 IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS); |
162 source_map->RegisterSource("enterprise.platformKeys.internalAPI", | 161 source_map->RegisterSource("enterprise.platformKeys.internalAPI", |
163 IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS); | 162 IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS); |
164 source_map->RegisterSource("enterprise.platformKeys.Key", | |
165 IDR_ENTERPRISE_PLATFORM_KEYS_KEY_JS); | |
166 source_map->RegisterSource("enterprise.platformKeys.KeyPair", | 163 source_map->RegisterSource("enterprise.platformKeys.KeyPair", |
167 IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS); | 164 IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS); |
168 source_map->RegisterSource("enterprise.platformKeys.SubtleCrypto", | 165 source_map->RegisterSource("enterprise.platformKeys.SubtleCrypto", |
169 IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); | 166 IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); |
170 source_map->RegisterSource("enterprise.platformKeys.Token", | 167 source_map->RegisterSource("enterprise.platformKeys.Token", |
171 IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS); | 168 IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS); |
172 source_map->RegisterSource("enterprise.platformKeys.utils", | |
173 IDR_ENTERPRISE_PLATFORM_KEYS_UTILS_JS); | |
174 source_map->RegisterSource("feedbackPrivate", | 169 source_map->RegisterSource("feedbackPrivate", |
175 IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS); | 170 IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS); |
176 source_map->RegisterSource("fileBrowserHandler", | 171 source_map->RegisterSource("fileBrowserHandler", |
177 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); | 172 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); |
178 source_map->RegisterSource("fileManagerPrivate", | 173 source_map->RegisterSource("fileManagerPrivate", |
179 IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS); | 174 IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS); |
180 source_map->RegisterSource("fileSystem", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); | 175 source_map->RegisterSource("fileSystem", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); |
181 source_map->RegisterSource("fileSystemProvider", | 176 source_map->RegisterSource("fileSystemProvider", |
182 IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS); | 177 IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS); |
183 source_map->RegisterSource("gcm", IDR_GCM_CUSTOM_BINDINGS_JS); | 178 source_map->RegisterSource("gcm", IDR_GCM_CUSTOM_BINDINGS_JS); |
184 source_map->RegisterSource("identity", IDR_IDENTITY_CUSTOM_BINDINGS_JS); | 179 source_map->RegisterSource("identity", IDR_IDENTITY_CUSTOM_BINDINGS_JS); |
185 source_map->RegisterSource("imageWriterPrivate", | 180 source_map->RegisterSource("imageWriterPrivate", |
186 IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS); | 181 IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS); |
187 source_map->RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); | 182 source_map->RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); |
188 source_map->RegisterSource("logPrivate", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS); | 183 source_map->RegisterSource("logPrivate", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS); |
189 source_map->RegisterSource("mediaGalleries", | 184 source_map->RegisterSource("mediaGalleries", |
190 IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); | 185 IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); |
191 source_map->RegisterSource("notifications", | 186 source_map->RegisterSource("notifications", |
192 IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS); | 187 IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS); |
193 source_map->RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); | 188 source_map->RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); |
194 source_map->RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); | 189 source_map->RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); |
195 source_map->RegisterSource("pageCapture", | 190 source_map->RegisterSource("pageCapture", |
196 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); | 191 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); |
| 192 source_map->RegisterSource("platformKeys.internalAPI", |
| 193 IDR_PLATFORM_KEYS_INTERNAL_API_JS); |
| 194 source_map->RegisterSource("platformKeys.Key", IDR_PLATFORM_KEYS_KEY_JS); |
| 195 source_map->RegisterSource("platformKeys.SubtleCrypto", |
| 196 IDR_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); |
| 197 source_map->RegisterSource("platformKeys.utils", IDR_PLATFORM_KEYS_UTILS_JS); |
197 source_map->RegisterSource("syncFileSystem", | 198 source_map->RegisterSource("syncFileSystem", |
198 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS); | 199 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS); |
199 source_map->RegisterSource("systemIndicator", | 200 source_map->RegisterSource("systemIndicator", |
200 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS); | 201 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS); |
201 source_map->RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS); | 202 source_map->RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS); |
202 source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); | 203 source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); |
203 source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); | 204 source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); |
204 source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); | 205 source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); |
205 #if defined(ENABLE_WEBRTC) | 206 #if defined(ENABLE_WEBRTC) |
206 source_map->RegisterSource("cast.streaming.rtpStream", | 207 source_map->RegisterSource("cast.streaming.rtpStream", |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 273 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
273 ::switches::kSingleProcess)) | 274 ::switches::kSingleProcess)) |
274 return; | 275 return; |
275 crash_keys::SetActiveExtensions(extension_ids); | 276 crash_keys::SetActiveExtensions(extension_ids); |
276 } | 277 } |
277 | 278 |
278 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { | 279 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { |
279 extensions::SetCurrentChannel( | 280 extensions::SetCurrentChannel( |
280 static_cast<chrome::VersionInfo::Channel>(channel)); | 281 static_cast<chrome::VersionInfo::Channel>(channel)); |
281 } | 282 } |
OLD | NEW |