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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 extension->url(), | 89 extension->url(), |
90 blink::WebString::fromUTF8(content::kChromeUIScheme), | 90 blink::WebString::fromUTF8(content::kChromeUIScheme), |
91 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), | 91 blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), |
92 false); | 92 false); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( | 96 void ChromeExtensionsDispatcherDelegate::RegisterNativeHandlers( |
97 extensions::Dispatcher* dispatcher, | 97 extensions::Dispatcher* dispatcher, |
98 extensions::ModuleSystem* module_system, | 98 extensions::ModuleSystem* module_system, |
| 99 extensions::ExtensionBindingsSystem* bindings_system, |
99 extensions::ScriptContext* context) { | 100 extensions::ScriptContext* context) { |
100 module_system->RegisterNativeHandler( | 101 module_system->RegisterNativeHandler( |
101 "app", std::unique_ptr<NativeHandler>( | 102 "app", std::unique_ptr<NativeHandler>( |
102 new extensions::AppBindings(dispatcher, context))); | 103 new extensions::AppBindings(dispatcher, context))); |
103 module_system->RegisterNativeHandler( | 104 module_system->RegisterNativeHandler( |
104 "sync_file_system", | 105 "sync_file_system", |
105 std::unique_ptr<NativeHandler>( | 106 std::unique_ptr<NativeHandler>( |
106 new extensions::SyncFileSystemCustomBindings(context))); | 107 new extensions::SyncFileSystemCustomBindings(context))); |
107 #if defined(OS_CHROMEOS) | 108 #if defined(OS_CHROMEOS) |
108 module_system->RegisterNativeHandler( | 109 module_system->RegisterNativeHandler( |
(...skipping 19 matching lines...) Expand all Loading... |
128 new extensions::MediaGalleriesCustomBindings(context))); | 129 new extensions::MediaGalleriesCustomBindings(context))); |
129 module_system->RegisterNativeHandler( | 130 module_system->RegisterNativeHandler( |
130 "page_capture", std::unique_ptr<NativeHandler>( | 131 "page_capture", std::unique_ptr<NativeHandler>( |
131 new extensions::PageCaptureCustomBindings(context))); | 132 new extensions::PageCaptureCustomBindings(context))); |
132 module_system->RegisterNativeHandler( | 133 module_system->RegisterNativeHandler( |
133 "webstore", std::unique_ptr<NativeHandler>( | 134 "webstore", std::unique_ptr<NativeHandler>( |
134 new extensions::WebstoreBindings(context))); | 135 new extensions::WebstoreBindings(context))); |
135 #if BUILDFLAG(ENABLE_WEBRTC) | 136 #if BUILDFLAG(ENABLE_WEBRTC) |
136 module_system->RegisterNativeHandler( | 137 module_system->RegisterNativeHandler( |
137 "cast_streaming_natives", | 138 "cast_streaming_natives", |
138 std::unique_ptr<NativeHandler>( | 139 base::MakeUnique<extensions::CastStreamingNativeHandler>( |
139 new extensions::CastStreamingNativeHandler(context))); | 140 context, bindings_system)); |
140 #endif | 141 #endif |
141 module_system->RegisterNativeHandler( | 142 module_system->RegisterNativeHandler( |
142 "automationInternal", | 143 "automationInternal", |
143 std::unique_ptr<NativeHandler>( | 144 base::MakeUnique<extensions::AutomationInternalCustomBindings>( |
144 new extensions::AutomationInternalCustomBindings(context))); | 145 context, bindings_system)); |
145 | 146 |
146 // The following are native handlers that are defined in //extensions, but | 147 // The following are native handlers that are defined in //extensions, but |
147 // are only used for APIs defined in Chrome. | 148 // are only used for APIs defined in Chrome. |
148 // TODO(devlin): We should clean this up. If an API is defined in Chrome, | 149 // TODO(devlin): We should clean this up. If an API is defined in Chrome, |
149 // there's no reason to have its native handlers residing and being compiled | 150 // there's no reason to have its native handlers residing and being compiled |
150 // in //extensions. | 151 // in //extensions. |
151 module_system->RegisterNativeHandler( | 152 module_system->RegisterNativeHandler( |
152 "i18n", std::unique_ptr<NativeHandler>( | 153 "i18n", std::unique_ptr<NativeHandler>( |
153 new extensions::I18NCustomBindings(context))); | 154 new extensions::I18NCustomBindings(context))); |
154 module_system->RegisterNativeHandler( | 155 module_system->RegisterNativeHandler( |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 280 } |
280 | 281 |
281 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 282 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
282 const std::set<std::string>& extension_ids) { | 283 const std::set<std::string>& extension_ids) { |
283 // In single-process mode, the browser process reports the active extensions. | 284 // In single-process mode, the browser process reports the active extensions. |
284 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 285 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
285 ::switches::kSingleProcess)) | 286 ::switches::kSingleProcess)) |
286 return; | 287 return; |
287 crash_keys::SetActiveExtensions(extension_ids); | 288 crash_keys::SetActiveExtensions(extension_ids); |
288 } | 289 } |
OLD | NEW |