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