| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 246       IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); | 246       IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); | 
| 247   source_map->RegisterSource( | 247   source_map->RegisterSource( | 
| 248       "cast.streaming.receiverSession", | 248       "cast.streaming.receiverSession", | 
| 249       IDR_CAST_STREAMING_RECEIVER_SESSION_CUSTOM_BINDINGS_JS); | 249       IDR_CAST_STREAMING_RECEIVER_SESSION_CUSTOM_BINDINGS_JS); | 
| 250 #endif | 250 #endif | 
| 251   source_map->RegisterSource( | 251   source_map->RegisterSource( | 
| 252       "webrtcDesktopCapturePrivate", | 252       "webrtcDesktopCapturePrivate", | 
| 253       IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS); | 253       IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS); | 
| 254   source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 254   source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 
| 255 | 255 | 
| 256   // Custom types sources. |  | 
| 257   source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |  | 
| 258   source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |  | 
| 259   source_map->RegisterSource("ChromeDirectSetting", |  | 
| 260                              IDR_CHROME_DIRECT_SETTING_JS); |  | 
| 261 | 256 | 
| 262   // Platform app sources that are not API-specific.. | 257   // Platform app sources that are not API-specific.. | 
| 263   source_map->RegisterSource("chromeWebViewInternal", | 258   source_map->RegisterSource("chromeWebViewInternal", | 
| 264                              IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 259                              IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 
| 265   source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); | 260   source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); | 
| 266 | 261 | 
| 267   // Media router. | 262   // Media router. | 
| 268   source_map->RegisterSource( | 263   source_map->RegisterSource( | 
| 269       "chrome/common/media_router/mojo/media_controller.mojom", | 264       "chrome/common/media_router/mojo/media_controller.mojom", | 
| 270       IDR_MEDIA_CONTROLLER_MOJOM_JS); | 265       IDR_MEDIA_CONTROLLER_MOJOM_JS); | 
| 271   source_map->RegisterSource( | 266   source_map->RegisterSource( | 
| 272       "chrome/common/media_router/mojo/media_router.mojom", | 267       "chrome/common/media_router/mojo/media_router.mojom", | 
| 273       IDR_MEDIA_ROUTER_MOJOM_JS); | 268       IDR_MEDIA_ROUTER_MOJOM_JS); | 
| 274   source_map->RegisterSource( | 269   source_map->RegisterSource( | 
| 275       "chrome/common/media_router/mojo/media_status.mojom", | 270       "chrome/common/media_router/mojo/media_status.mojom", | 
| 276       IDR_MEDIA_STATUS_MOJOM_JS); | 271       IDR_MEDIA_STATUS_MOJOM_JS); | 
| 277   source_map->RegisterSource("media_router_bindings", | 272   source_map->RegisterSource("media_router_bindings", | 
| 278                              IDR_MEDIA_ROUTER_BINDINGS_JS); | 273                              IDR_MEDIA_ROUTER_BINDINGS_JS); | 
| 279   source_map->RegisterSource("mojo/common/time.mojom", IDR_MOJO_TIME_MOJOM_JS); | 274   source_map->RegisterSource("mojo/common/time.mojom", IDR_MOJO_TIME_MOJOM_JS); | 
| 280   source_map->RegisterSource("net/interfaces/ip_address.mojom", | 275   source_map->RegisterSource("net/interfaces/ip_address.mojom", | 
| 281                              IDR_MOJO_IP_ADDRESS_MOJOM_JS); | 276                              IDR_MOJO_IP_ADDRESS_MOJOM_JS); | 
| 282   source_map->RegisterSource("url/mojo/origin.mojom", IDR_ORIGIN_MOJOM_JS); | 277   source_map->RegisterSource("url/mojo/origin.mojom", IDR_ORIGIN_MOJOM_JS); | 
| 283   source_map->RegisterSource("url/mojo/url.mojom", IDR_MOJO_URL_MOJOM_JS); | 278   source_map->RegisterSource("url/mojo/url.mojom", IDR_MOJO_URL_MOJOM_JS); | 
| 284 | 279 | 
| 285   // These bindings are unnecessary with native bindings enabled. | 280   // These bindings are unnecessary with native bindings enabled. | 
| 286   if (!extensions::FeatureSwitch::native_crx_bindings()->IsEnabled()) | 281   if (!extensions::FeatureSwitch::native_crx_bindings()->IsEnabled()) { | 
| 287     source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); | 282     source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); | 
|  | 283 | 
|  | 284     // Custom types sources. | 
|  | 285     source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 
|  | 286     source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 
|  | 287     source_map->RegisterSource("ChromeDirectSetting", | 
|  | 288                                IDR_CHROME_DIRECT_SETTING_JS); | 
|  | 289   } | 
| 288 } | 290 } | 
| 289 | 291 | 
| 290 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( | 292 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( | 
| 291     extensions::ScriptContext* context) { | 293     extensions::ScriptContext* context) { | 
| 292   // Note: setting up the WebView class here, not the chrome.webview API. | 294   // Note: setting up the WebView class here, not the chrome.webview API. | 
| 293   // The API will be automatically set up when first used. | 295   // The API will be automatically set up when first used. | 
| 294   if (context->GetAvailability("webViewInternal").is_available()) { | 296   if (context->GetAvailability("webViewInternal").is_available()) { | 
| 295     // TODO(fsamuel): Eagerly calling Require on context startup is expensive. | 297     // TODO(fsamuel): Eagerly calling Require on context startup is expensive. | 
| 296     // It would be better if there were a light way of detecting when a webview | 298     // It would be better if there were a light way of detecting when a webview | 
| 297     // or appview is created and only then set up the infrastructure. | 299     // or appview is created and only then set up the infrastructure. | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 309 } | 311 } | 
| 310 | 312 | 
| 311 void ChromeExtensionsDispatcherDelegate::InitializeBindingsSystem( | 313 void ChromeExtensionsDispatcherDelegate::InitializeBindingsSystem( | 
| 312     extensions::Dispatcher* dispatcher, | 314     extensions::Dispatcher* dispatcher, | 
| 313     extensions::APIBindingsSystem* bindings_system) { | 315     extensions::APIBindingsSystem* bindings_system) { | 
| 314   DCHECK(extensions::FeatureSwitch::native_crx_bindings()->IsEnabled()); | 316   DCHECK(extensions::FeatureSwitch::native_crx_bindings()->IsEnabled()); | 
| 315   bindings_system->GetHooksForAPI("app")->SetDelegate( | 317   bindings_system->GetHooksForAPI("app")->SetDelegate( | 
| 316       base::MakeUnique<extensions::AppHooksDelegate>( | 318       base::MakeUnique<extensions::AppHooksDelegate>( | 
| 317           dispatcher, bindings_system->request_handler())); | 319           dispatcher, bindings_system->request_handler())); | 
| 318 } | 320 } | 
| OLD | NEW | 
|---|