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 <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" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 source_map->RegisterSource("ChromeDirectSetting", | 257 source_map->RegisterSource("ChromeDirectSetting", |
258 IDR_CHROME_DIRECT_SETTING_JS); | 258 IDR_CHROME_DIRECT_SETTING_JS); |
259 | 259 |
260 // Platform app sources that are not API-specific.. | 260 // Platform app sources that are not API-specific.. |
261 source_map->RegisterSource("fileEntryBindingUtil", | 261 source_map->RegisterSource("fileEntryBindingUtil", |
262 IDR_FILE_ENTRY_BINDING_UTIL_JS); | 262 IDR_FILE_ENTRY_BINDING_UTIL_JS); |
263 source_map->RegisterSource("chromeWebViewInternal", | 263 source_map->RegisterSource("chromeWebViewInternal", |
264 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 264 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); |
265 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); | 265 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); |
266 | 266 |
267 #if defined(ENABLE_MEDIA_ROUTER) | 267 // Media router. |
268 source_map->RegisterSource( | 268 source_map->RegisterSource( |
269 "chrome/common/media_router/mojo/media_controller.mojom", | 269 "chrome/common/media_router/mojo/media_controller.mojom", |
270 IDR_MEDIA_CONTROLLER_MOJOM_JS); | 270 IDR_MEDIA_CONTROLLER_MOJOM_JS); |
271 source_map->RegisterSource( | 271 source_map->RegisterSource( |
272 "chrome/common/media_router/mojo/media_router.mojom", | 272 "chrome/common/media_router/mojo/media_router.mojom", |
273 IDR_MEDIA_ROUTER_MOJOM_JS); | 273 IDR_MEDIA_ROUTER_MOJOM_JS); |
274 source_map->RegisterSource( | 274 source_map->RegisterSource( |
275 "chrome/common/media_router/mojo/media_status.mojom", | 275 "chrome/common/media_router/mojo/media_status.mojom", |
276 IDR_MEDIA_STATUS_MOJOM_JS); | 276 IDR_MEDIA_STATUS_MOJOM_JS); |
277 source_map->RegisterSource("media_router_bindings", | 277 source_map->RegisterSource("media_router_bindings", |
278 IDR_MEDIA_ROUTER_BINDINGS_JS); | 278 IDR_MEDIA_ROUTER_BINDINGS_JS); |
279 source_map->RegisterSource("mojo/common/time.mojom", IDR_MOJO_TIME_MOJOM_JS); | 279 source_map->RegisterSource("mojo/common/time.mojom", IDR_MOJO_TIME_MOJOM_JS); |
280 source_map->RegisterSource("net/interfaces/ip_address.mojom", | 280 source_map->RegisterSource("net/interfaces/ip_address.mojom", |
281 IDR_MOJO_IP_ADDRESS_MOJOM_JS); | 281 IDR_MOJO_IP_ADDRESS_MOJOM_JS); |
282 source_map->RegisterSource("url/mojo/origin.mojom", IDR_ORIGIN_MOJOM_JS); | 282 source_map->RegisterSource("url/mojo/origin.mojom", IDR_ORIGIN_MOJOM_JS); |
283 source_map->RegisterSource("url/mojo/url.mojom", IDR_MOJO_URL_MOJOM_JS); | 283 source_map->RegisterSource("url/mojo/url.mojom", IDR_MOJO_URL_MOJOM_JS); |
284 #endif // defined(ENABLE_MEDIA_ROUTER) | |
285 } | 284 } |
286 | 285 |
287 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( | 286 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( |
288 extensions::ScriptContext* context) { | 287 extensions::ScriptContext* context) { |
289 // Note: setting up the WebView class here, not the chrome.webview API. | 288 // Note: setting up the WebView class here, not the chrome.webview API. |
290 // The API will be automatically set up when first used. | 289 // The API will be automatically set up when first used. |
291 if (context->GetAvailability("webViewInternal").is_available()) { | 290 if (context->GetAvailability("webViewInternal").is_available()) { |
292 // TODO(fsamuel): Eagerly calling Require on context startup is expensive. | 291 // TODO(fsamuel): Eagerly calling Require on context startup is expensive. |
293 // It would be better if there were a light way of detecting when a webview | 292 // It would be better if there were a light way of detecting when a webview |
294 // or appview is created and only then set up the infrastructure. | 293 // or appview is created and only then set up the infrastructure. |
295 context->module_system()->Require("chromeWebView"); | 294 context->module_system()->Require("chromeWebView"); |
296 } | 295 } |
297 } | 296 } |
298 | 297 |
299 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 298 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
300 const std::set<std::string>& extension_ids) { | 299 const std::set<std::string>& extension_ids) { |
301 // In single-process mode, the browser process reports the active extensions. | 300 // In single-process mode, the browser process reports the active extensions. |
302 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 301 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
303 ::switches::kSingleProcess)) | 302 ::switches::kSingleProcess)) |
304 return; | 303 return; |
305 crash_keys::SetActiveExtensions(extension_ids); | 304 crash_keys::SetActiveExtensions(extension_ids); |
306 } | 305 } |
OLD | NEW |