Chromium Code Reviews| 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/channel_info.h" | 10 #include "chrome/common/channel_info.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #include "content/public/renderer/render_thread.h" | 30 #include "content/public/renderer/render_thread.h" |
| 31 #include "content/public/renderer/render_view.h" | 31 #include "content/public/renderer/render_view.h" |
| 32 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
| 33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 34 #include "extensions/common/feature_switch.h" | 34 #include "extensions/common/feature_switch.h" |
| 35 #include "extensions/common/permissions/manifest_permission_set.h" | 35 #include "extensions/common/permissions/manifest_permission_set.h" |
| 36 #include "extensions/common/permissions/permission_set.h" | 36 #include "extensions/common/permissions/permission_set.h" |
| 37 #include "extensions/common/permissions/permissions_data.h" | 37 #include "extensions/common/permissions/permissions_data.h" |
| 38 #include "extensions/common/switches.h" | 38 #include "extensions/common/switches.h" |
| 39 #include "extensions/renderer/dispatcher.h" | 39 #include "extensions/renderer/dispatcher.h" |
| 40 #include "extensions/renderer/i18n_custom_bindings.h" | |
| 41 #include "extensions/renderer/lazy_background_page_native_handler.h" | |
| 40 #include "extensions/renderer/native_handler.h" | 42 #include "extensions/renderer/native_handler.h" |
| 41 #include "extensions/renderer/resource_bundle_source_map.h" | 43 #include "extensions/renderer/resource_bundle_source_map.h" |
| 42 #include "extensions/renderer/script_context.h" | 44 #include "extensions/renderer/script_context.h" |
| 43 #include "third_party/WebKit/public/platform/WebString.h" | 45 #include "third_party/WebKit/public/platform/WebString.h" |
| 44 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 46 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 45 | 47 |
| 46 #if defined(ENABLE_WEBRTC) | 48 #if defined(ENABLE_WEBRTC) |
| 47 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" | 49 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" |
| 48 #endif | 50 #endif |
| 49 | 51 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 #if defined(ENABLE_WEBRTC) | 118 #if defined(ENABLE_WEBRTC) |
| 117 module_system->RegisterNativeHandler( | 119 module_system->RegisterNativeHandler( |
| 118 "cast_streaming_natives", | 120 "cast_streaming_natives", |
| 119 scoped_ptr<NativeHandler>( | 121 scoped_ptr<NativeHandler>( |
| 120 new extensions::CastStreamingNativeHandler(context))); | 122 new extensions::CastStreamingNativeHandler(context))); |
| 121 #endif | 123 #endif |
| 122 module_system->RegisterNativeHandler( | 124 module_system->RegisterNativeHandler( |
| 123 "automationInternal", | 125 "automationInternal", |
| 124 scoped_ptr<NativeHandler>( | 126 scoped_ptr<NativeHandler>( |
| 125 new extensions::AutomationInternalCustomBindings(context))); | 127 new extensions::AutomationInternalCustomBindings(context))); |
| 128 | |
| 129 // The following are native handlers that are defined in //extensions, but | |
| 130 // are only used for APIs defined in Chrome. | |
| 131 // TODO(devlin): We should clean this up. If an API is defined in Chrome, | |
| 132 // there's no reason to have its native handlers residing and being compiled | |
| 133 // in //extensions. | |
|
asargent_no_longer_on_chrome
2016/04/11 17:30:14
Can you explain why you moved these here from //ex
Devlin
2016/04/13 19:51:26
These are for features that are only available in
asargent_no_longer_on_chrome
2016/04/13 23:02:40
Ok, the part about i18n makes sense since its impl
Devlin
2016/04/15 21:39:24
Right now, it's only used by tts, and tts is a fea
| |
| 134 module_system->RegisterNativeHandler( | |
| 135 "i18n", | |
| 136 scoped_ptr<NativeHandler>(new extensions::I18NCustomBindings(context))); | |
| 137 module_system->RegisterNativeHandler( | |
| 138 "lazy_background_page", | |
| 139 scoped_ptr<NativeHandler>( | |
| 140 new extensions::LazyBackgroundPageNativeHandler(context))); | |
| 126 } | 141 } |
| 127 | 142 |
| 128 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( | 143 void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( |
| 129 extensions::ResourceBundleSourceMap* source_map) { | 144 extensions::ResourceBundleSourceMap* source_map) { |
| 130 // Custom bindings. | 145 // Custom bindings. |
| 131 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); | 146 source_map->RegisterSource("app", IDR_APP_CUSTOM_BINDINGS_JS); |
| 132 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS); | 147 source_map->RegisterSource("automation", IDR_AUTOMATION_CUSTOM_BINDINGS_JS); |
| 133 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS); | 148 source_map->RegisterSource("automationEvent", IDR_AUTOMATION_EVENT_JS); |
| 134 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS); | 149 source_map->RegisterSource("automationNode", IDR_AUTOMATION_NODE_JS); |
| 135 source_map->RegisterSource("browserAction", | 150 source_map->RegisterSource("browserAction", |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 } | 277 } |
| 263 | 278 |
| 264 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { | 279 void ChromeExtensionsDispatcherDelegate::SetChannel(int channel) { |
| 265 extensions::SetCurrentChannel(static_cast<version_info::Channel>(channel)); | 280 extensions::SetCurrentChannel(static_cast<version_info::Channel>(channel)); |
| 266 if (extensions::feature_util::ExtensionServiceWorkersEnabled()) { | 281 if (extensions::feature_util::ExtensionServiceWorkersEnabled()) { |
| 267 // chrome-extension: resources should be allowed to register ServiceWorkers. | 282 // chrome-extension: resources should be allowed to register ServiceWorkers. |
| 268 blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( | 283 blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( |
| 269 blink::WebString::fromUTF8(extensions::kExtensionScheme)); | 284 blink::WebString::fromUTF8(extensions::kExtensionScheme)); |
| 270 } | 285 } |
| 271 } | 286 } |
| OLD | NEW |