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/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 #endif | 220 #endif |
221 source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 221 source_map->RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); |
222 | 222 |
223 // Custom types sources. | 223 // Custom types sources. |
224 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 224 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
225 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 225 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
226 source_map->RegisterSource("ChromeDirectSetting", | 226 source_map->RegisterSource("ChromeDirectSetting", |
227 IDR_CHROME_DIRECT_SETTING_JS); | 227 IDR_CHROME_DIRECT_SETTING_JS); |
228 | 228 |
229 // Platform app sources that are not API-specific.. | 229 // Platform app sources that are not API-specific.. |
230 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); | |
231 source_map->RegisterSource("fileEntryBindingUtil", | 230 source_map->RegisterSource("fileEntryBindingUtil", |
232 IDR_FILE_ENTRY_BINDING_UTIL_JS); | 231 IDR_FILE_ENTRY_BINDING_UTIL_JS); |
233 source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); | 232 source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); |
234 source_map->RegisterSource("extensionOptionsEvents", | 233 source_map->RegisterSource("extensionOptionsEvents", |
235 IDR_EXTENSION_OPTIONS_EVENTS_JS); | 234 IDR_EXTENSION_OPTIONS_EVENTS_JS); |
236 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); | 235 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); |
237 source_map->RegisterSource("chromeWebViewInternal", | 236 source_map->RegisterSource("chromeWebViewInternal", |
238 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 237 IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); |
239 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); | 238 source_map->RegisterSource("chromeWebView", IDR_CHROME_WEB_VIEW_JS); |
240 source_map->RegisterSource("chromeWebViewExperimental", | 239 source_map->RegisterSource("chromeWebViewExperimental", |
241 IDR_CHROME_WEB_VIEW_EXPERIMENTAL_JS); | 240 IDR_CHROME_WEB_VIEW_EXPERIMENTAL_JS); |
242 source_map->RegisterSource("denyAppView", IDR_APP_VIEW_DENY_JS); | |
243 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); | 241 source_map->RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); |
244 } | 242 } |
245 | 243 |
246 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( | 244 void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules( |
247 extensions::ScriptContext* context, | 245 extensions::ScriptContext* context, |
248 bool is_within_platform_app) { | 246 bool is_within_platform_app) { |
249 extensions::ModuleSystem* module_system = context->module_system(); | 247 extensions::ModuleSystem* module_system = context->module_system(); |
250 extensions::Feature::Context context_type = context->context_type(); | 248 extensions::Feature::Context context_type = context->context_type(); |
251 | 249 |
252 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is | 250 // TODO(kalman, fsamuel): Eagerly calling Require on context startup is |
(...skipping 10 matching lines...) Expand all Loading... |
263 // Note: setting up the WebView class here, not the chrome.webview API. | 261 // Note: setting up the WebView class here, not the chrome.webview API. |
264 // The API will be automatically set up when first used. | 262 // The API will be automatically set up when first used. |
265 if (context->GetAvailability("webViewInternal").is_available()) { | 263 if (context->GetAvailability("webViewInternal").is_available()) { |
266 module_system->Require("chromeWebView"); | 264 module_system->Require("chromeWebView"); |
267 if (context->GetAvailability("webViewExperimentalInternal") | 265 if (context->GetAvailability("webViewExperimentalInternal") |
268 .is_available()) { | 266 .is_available()) { |
269 module_system->Require("chromeWebViewExperimental"); | 267 module_system->Require("chromeWebViewExperimental"); |
270 } | 268 } |
271 } | 269 } |
272 | 270 |
273 if (context->GetAvailability("appViewEmbedderInternal").is_available()) { | |
274 module_system->Require("appView"); | |
275 } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { | |
276 module_system->Require("denyAppView"); | |
277 } | |
278 | |
279 if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() && | 271 if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() && |
280 context->GetAvailability("extensionOptionsInternal").is_available()) { | 272 context->GetAvailability("extensionOptionsInternal").is_available()) { |
281 module_system->Require("extensionOptions"); | 273 module_system->Require("extensionOptions"); |
282 } | 274 } |
283 } | 275 } |
284 | 276 |
285 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 277 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
286 const std::set<std::string>& extension_ids) { | 278 const std::set<std::string>& extension_ids) { |
287 // In single-process mode, the browser process reports the active extensions. | 279 // In single-process mode, the browser process reports the active extensions. |
288 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) | 280 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 if (!extension) | 322 if (!extension) |
331 return; | 323 return; |
332 | 324 |
333 extension->permissions_data()->UpdateTabSpecificPermissions( | 325 extension->permissions_data()->UpdateTabSpecificPermissions( |
334 tab_id, | 326 tab_id, |
335 new extensions::PermissionSet(extensions::APIPermissionSet(), | 327 new extensions::PermissionSet(extensions::APIPermissionSet(), |
336 extensions::ManifestPermissionSet(), | 328 extensions::ManifestPermissionSet(), |
337 origin_set, | 329 origin_set, |
338 extensions::URLPatternSet())); | 330 extensions::URLPatternSet())); |
339 } | 331 } |
OLD | NEW |