Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 2367653002: Exclude rest of chromeos-only API related from compiling in non-chromeos. (Closed)
Patch Set: sync Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/BUILD.gn ('k') | chrome/renderer/resources/renderer_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "chrome/common/channel_info.h" 12 #include "chrome/common/channel_info.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/crash_keys.h" 14 #include "chrome/common/crash_keys.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/grit/renderer_resources.h" 16 #include "chrome/grit/renderer_resources.h"
17 #include "chrome/renderer/extensions/app_bindings.h" 17 #include "chrome/renderer/extensions/app_bindings.h"
18 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h" 18 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
19 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" 19 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h"
20 #include "chrome/renderer/extensions/notifications_native_handler.h" 20 #include "chrome/renderer/extensions/notifications_native_handler.h"
21 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" 21 #include "chrome/renderer/extensions/page_capture_custom_bindings.h"
22 #include "chrome/renderer/extensions/platform_keys_natives.h"
23 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" 22 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h"
24 #include "chrome/renderer/extensions/webstore_bindings.h" 23 #include "chrome/renderer/extensions/webstore_bindings.h"
25 #include "components/version_info/version_info.h" 24 #include "components/version_info/version_info.h"
26 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
27 #include "content/public/renderer/render_thread.h" 26 #include "content/public/renderer/render_thread.h"
28 #include "content/public/renderer/render_view.h" 27 #include "content/public/renderer/render_view.h"
29 #include "extensions/common/constants.h" 28 #include "extensions/common/constants.h"
30 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
31 #include "extensions/common/feature_switch.h" 30 #include "extensions/common/feature_switch.h"
32 #include "extensions/common/features/feature_channel.h" 31 #include "extensions/common/features/feature_channel.h"
(...skipping 11 matching lines...) Expand all
44 #include "third_party/WebKit/public/platform/WebString.h" 43 #include "third_party/WebKit/public/platform/WebString.h"
45 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 44 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
46 45
47 #if defined(ENABLE_WEBRTC) 46 #if defined(ENABLE_WEBRTC)
48 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" 47 #include "chrome/renderer/extensions/cast_streaming_native_handler.h"
49 #endif 48 #endif
50 49
51 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
52 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" 51 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h"
53 #include "chrome/renderer/extensions/file_manager_private_custom_bindings.h" 52 #include "chrome/renderer/extensions/file_manager_private_custom_bindings.h"
53 #include "chrome/renderer/extensions/platform_keys_natives.h"
54 #endif 54 #endif
55 55
56 using extensions::NativeHandler; 56 using extensions::NativeHandler;
57 57
58 ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() { 58 ChromeExtensionsDispatcherDelegate::ChromeExtensionsDispatcherDelegate() {
59 } 59 }
60 60
61 ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() { 61 ChromeExtensionsDispatcherDelegate::~ChromeExtensionsDispatcherDelegate() {
62 } 62 }
63 63
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 new extensions::SyncFileSystemCustomBindings(context))); 105 new extensions::SyncFileSystemCustomBindings(context)));
106 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
107 module_system->RegisterNativeHandler( 107 module_system->RegisterNativeHandler(
108 "file_browser_handler", 108 "file_browser_handler",
109 std::unique_ptr<NativeHandler>( 109 std::unique_ptr<NativeHandler>(
110 new extensions::FileBrowserHandlerCustomBindings(context))); 110 new extensions::FileBrowserHandlerCustomBindings(context)));
111 module_system->RegisterNativeHandler( 111 module_system->RegisterNativeHandler(
112 "file_manager_private", 112 "file_manager_private",
113 std::unique_ptr<NativeHandler>( 113 std::unique_ptr<NativeHandler>(
114 new extensions::FileManagerPrivateCustomBindings(context))); 114 new extensions::FileManagerPrivateCustomBindings(context)));
115 module_system->RegisterNativeHandler(
116 "platform_keys_natives",
117 std::unique_ptr<NativeHandler>(
118 new extensions::PlatformKeysNatives(context)));
115 #endif // defined(OS_CHROMEOS) 119 #endif // defined(OS_CHROMEOS)
116 module_system->RegisterNativeHandler( 120 module_system->RegisterNativeHandler(
117 "notifications_private", 121 "notifications_private",
118 std::unique_ptr<NativeHandler>( 122 std::unique_ptr<NativeHandler>(
119 new extensions::NotificationsNativeHandler(context))); 123 new extensions::NotificationsNativeHandler(context)));
120 module_system->RegisterNativeHandler( 124 module_system->RegisterNativeHandler(
121 "mediaGalleries", 125 "mediaGalleries",
122 std::unique_ptr<NativeHandler>( 126 std::unique_ptr<NativeHandler>(
123 new extensions::MediaGalleriesCustomBindings(context))); 127 new extensions::MediaGalleriesCustomBindings(context)));
124 module_system->RegisterNativeHandler( 128 module_system->RegisterNativeHandler(
125 "page_capture", std::unique_ptr<NativeHandler>( 129 "page_capture", std::unique_ptr<NativeHandler>(
126 new extensions::PageCaptureCustomBindings(context))); 130 new extensions::PageCaptureCustomBindings(context)));
127 module_system->RegisterNativeHandler( 131 module_system->RegisterNativeHandler(
128 "platform_keys_natives",
129 std::unique_ptr<NativeHandler>(
130 new extensions::PlatformKeysNatives(context)));
131 module_system->RegisterNativeHandler(
132 "webstore", std::unique_ptr<NativeHandler>( 132 "webstore", std::unique_ptr<NativeHandler>(
133 new extensions::WebstoreBindings(context))); 133 new extensions::WebstoreBindings(context)));
134 #if defined(ENABLE_WEBRTC) 134 #if defined(ENABLE_WEBRTC)
135 module_system->RegisterNativeHandler( 135 module_system->RegisterNativeHandler(
136 "cast_streaming_natives", 136 "cast_streaming_natives",
137 std::unique_ptr<NativeHandler>( 137 std::unique_ptr<NativeHandler>(
138 new extensions::CastStreamingNativeHandler(context))); 138 new extensions::CastStreamingNativeHandler(context)));
139 #endif 139 #endif
140 module_system->RegisterNativeHandler( 140 module_system->RegisterNativeHandler(
141 "automationInternal", 141 "automationInternal",
(...skipping 19 matching lines...) Expand all
161 161
162 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( 162 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap(
163 extensions::ResourceBundleSourceMap* source_map) { 163 extensions::ResourceBundleSourceMap* source_map) {
164 // Custom bindings. 164 // Custom bindings.
165 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); 165 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS);
166 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS); 166 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS);
167 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS); 167 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS);
168 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS); 168 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS);
169 source_map->RegisterSource("browserAction", 169 source_map->RegisterSource("browserAction",
170 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); 170 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS);
171 source_map->RegisterSource("certificateProvider",
172 IDR_CERTIFICATE_PROVIDER_CUSTOM_BINDINGS_JS);
173 source_map->RegisterSource("declarativeContent", 171 source_map->RegisterSource("declarativeContent",
174 IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS); 172 IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS);
175 source_map->RegisterSource("desktopCapture", 173 source_map->RegisterSource("desktopCapture",
176 IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS); 174 IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS);
177 source_map->RegisterSource("developerPrivate", 175 source_map->RegisterSource("developerPrivate",
178 IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS); 176 IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS);
179 source_map->RegisterSource("downloads", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS); 177 source_map->RegisterSource("downloads", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS);
180 source_map->RegisterSource("enterprise.platformKeys",
181 IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS);
182 source_map->RegisterSource("enterprise.platformKeys.internalAPI",
183 IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS);
184 source_map->RegisterSource("enterprise.platformKeys.KeyPair",
185 IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS);
186 source_map->RegisterSource("enterprise.platformKeys.SubtleCrypto",
187 IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS);
188 source_map->RegisterSource("enterprise.platformKeys.Token",
189 IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS);
190 source_map->RegisterSource("feedbackPrivate", 178 source_map->RegisterSource("feedbackPrivate",
191 IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS); 179 IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS);
192 #if defined(OS_CHROMEOS)
193 source_map->RegisterSource("fileBrowserHandler",
194 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS);
195 source_map->RegisterSource("fileManagerPrivate",
196 IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS);
197 #endif // defined(OS_CHROMEOS)
198 source_map->RegisterSource("fileSystem", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); 180 source_map->RegisterSource("fileSystem", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
199 source_map->RegisterSource("fileSystemProvider",
200 IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS);
201 source_map->RegisterSource("gcm", IDR_GCM_CUSTOM_BINDINGS_JS); 181 source_map->RegisterSource("gcm", IDR_GCM_CUSTOM_BINDINGS_JS);
202 source_map->RegisterSource("identity", IDR_IDENTITY_CUSTOM_BINDINGS_JS); 182 source_map->RegisterSource("identity", IDR_IDENTITY_CUSTOM_BINDINGS_JS);
203 source_map->RegisterSource("imageWriterPrivate", 183 source_map->RegisterSource("imageWriterPrivate",
204 IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS); 184 IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS);
205 source_map->RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); 185 source_map->RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS);
206 source_map->RegisterSource("logPrivate", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS); 186 source_map->RegisterSource("logPrivate", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS);
207 source_map->RegisterSource("mediaGalleries", 187 source_map->RegisterSource("mediaGalleries",
208 IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); 188 IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS);
209 source_map->RegisterSource("notifications", 189 source_map->RegisterSource("notifications",
210 IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS); 190 IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS);
211 source_map->RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); 191 source_map->RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS);
212 source_map->RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); 192 source_map->RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS);
213 source_map->RegisterSource("pageCapture", 193 source_map->RegisterSource("pageCapture",
214 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); 194 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS);
195 source_map->RegisterSource("syncFileSystem",
196 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
197 source_map->RegisterSource("systemIndicator",
198 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS);
199 source_map->RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS);
200 source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS);
201 source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS);
202 source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS);
203
204 #if defined(OS_CHROMEOS)
205 source_map->RegisterSource("certificateProvider",
206 IDR_CERTIFICATE_PROVIDER_CUSTOM_BINDINGS_JS);
207 source_map->RegisterSource("enterprise.platformKeys",
208 IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS);
209 source_map->RegisterSource("enterprise.platformKeys.internalAPI",
210 IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS);
211 source_map->RegisterSource("enterprise.platformKeys.KeyPair",
212 IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS);
213 source_map->RegisterSource("enterprise.platformKeys.SubtleCrypto",
214 IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS);
215 source_map->RegisterSource("enterprise.platformKeys.Token",
216 IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS);
217 source_map->RegisterSource("fileBrowserHandler",
218 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS);
219 source_map->RegisterSource("fileManagerPrivate",
220 IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS);
221 source_map->RegisterSource("fileSystemProvider",
222 IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS);
215 source_map->RegisterSource("platformKeys", 223 source_map->RegisterSource("platformKeys",
216 IDR_PLATFORM_KEYS_CUSTOM_BINDINGS_JS); 224 IDR_PLATFORM_KEYS_CUSTOM_BINDINGS_JS);
217 source_map->RegisterSource("platformKeys.getPublicKey", 225 source_map->RegisterSource("platformKeys.getPublicKey",
218 IDR_PLATFORM_KEYS_GET_PUBLIC_KEY_JS); 226 IDR_PLATFORM_KEYS_GET_PUBLIC_KEY_JS);
219 source_map->RegisterSource("platformKeys.internalAPI", 227 source_map->RegisterSource("platformKeys.internalAPI",
220 IDR_PLATFORM_KEYS_INTERNAL_API_JS); 228 IDR_PLATFORM_KEYS_INTERNAL_API_JS);
221 source_map->RegisterSource("platformKeys.Key", IDR_PLATFORM_KEYS_KEY_JS); 229 source_map->RegisterSource("platformKeys.Key", IDR_PLATFORM_KEYS_KEY_JS);
222 source_map->RegisterSource("platformKeys.SubtleCrypto", 230 source_map->RegisterSource("platformKeys.SubtleCrypto",
223 IDR_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); 231 IDR_PLATFORM_KEYS_SUBTLE_CRYPTO_JS);
224 source_map->RegisterSource("platformKeys.utils", IDR_PLATFORM_KEYS_UTILS_JS); 232 source_map->RegisterSource("platformKeys.utils", IDR_PLATFORM_KEYS_UTILS_JS);
225 source_map->RegisterSource("syncFileSystem",
226 IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
227 source_map->RegisterSource("systemIndicator",
228 IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS);
229 source_map->RegisterSource("tabCapture", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS);
230 source_map->RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS);
231 source_map->RegisterSource("terminalPrivate", 233 source_map->RegisterSource("terminalPrivate",
232 IDR_TERMINAL_PRIVATE_CUSTOM_BINDINGS_JS); 234 IDR_TERMINAL_PRIVATE_CUSTOM_BINDINGS_JS);
233 source_map->RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); 235 #endif // defined(OS_CHROMEOS)
234 source_map->RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); 236
235 #if defined(ENABLE_WEBRTC) 237 #if defined(ENABLE_WEBRTC)
236 source_map->RegisterSource("cast.streaming.rtpStream", 238 source_map->RegisterSource("cast.streaming.rtpStream",
237 IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS); 239 IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS);
238 source_map->RegisterSource("cast.streaming.session", 240 source_map->RegisterSource("cast.streaming.session",
239 IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS); 241 IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS);
240 source_map->RegisterSource( 242 source_map->RegisterSource(
241 "cast.streaming.udpTransport", 243 "cast.streaming.udpTransport",
242 IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); 244 IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS);
243 source_map->RegisterSource( 245 source_map->RegisterSource(
244 "cast.streaming.receiverSession", 246 "cast.streaming.receiverSession",
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 291 }
290 292
291 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( 293 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated(
292 const std::set<std::string>& extension_ids) { 294 const std::set<std::string>& extension_ids) {
293 // In single-process mode, the browser process reports the active extensions. 295 // In single-process mode, the browser process reports the active extensions.
294 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 296 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
295 ::switches::kSingleProcess)) 297 ::switches::kSingleProcess))
296 return; 298 return;
297 crash_keys::SetActiveExtensions(extension_ids); 299 crash_keys::SetActiveExtensions(extension_ids);
298 } 300 }
OLDNEW
« no previous file with comments | « chrome/renderer/BUILD.gn ('k') | chrome/renderer/resources/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698