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 12 matching lines...) Expand all Loading... |
23 #include "chrome/renderer/extensions/notifications_native_handler.h" | 23 #include "chrome/renderer/extensions/notifications_native_handler.h" |
24 #include "chrome/renderer/extensions/page_actions_custom_bindings.h" | 24 #include "chrome/renderer/extensions/page_actions_custom_bindings.h" |
25 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" | 25 #include "chrome/renderer/extensions/page_capture_custom_bindings.h" |
26 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" | 26 #include "chrome/renderer/extensions/sync_file_system_custom_bindings.h" |
27 #include "chrome/renderer/extensions/tab_finder.h" | 27 #include "chrome/renderer/extensions/tab_finder.h" |
28 #include "chrome/renderer/extensions/tabs_custom_bindings.h" | 28 #include "chrome/renderer/extensions/tabs_custom_bindings.h" |
29 #include "chrome/renderer/extensions/webstore_bindings.h" | 29 #include "chrome/renderer/extensions/webstore_bindings.h" |
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/extension.h" | 32 #include "extensions/common/extension.h" |
| 33 #include "extensions/common/feature_switch.h" |
33 #include "extensions/common/permissions/api_permission_set.h" | 34 #include "extensions/common/permissions/api_permission_set.h" |
34 #include "extensions/common/permissions/manifest_permission_set.h" | 35 #include "extensions/common/permissions/manifest_permission_set.h" |
35 #include "extensions/common/permissions/permission_set.h" | 36 #include "extensions/common/permissions/permission_set.h" |
36 #include "extensions/common/permissions/permissions_data.h" | 37 #include "extensions/common/permissions/permissions_data.h" |
37 #include "extensions/common/url_pattern_set.h" | 38 #include "extensions/common/url_pattern_set.h" |
38 #include "extensions/renderer/dispatcher.h" | 39 #include "extensions/renderer/dispatcher.h" |
39 #include "extensions/renderer/native_handler.h" | 40 #include "extensions/renderer/native_handler.h" |
40 #include "extensions/renderer/resource_bundle_source_map.h" | 41 #include "extensions/renderer/resource_bundle_source_map.h" |
41 #include "extensions/renderer/script_context.h" | 42 #include "extensions/renderer/script_context.h" |
42 #include "grit/renderer_resources.h" | 43 #include "grit/renderer_resources.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); | 232 source_map->RegisterSource("windowControls", IDR_WINDOW_CONTROLS_JS); |
232 | 233 |
233 // Custom types sources. | 234 // Custom types sources. |
234 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 235 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
235 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 236 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
236 source_map->RegisterSource("ChromeDirectSetting", | 237 source_map->RegisterSource("ChromeDirectSetting", |
237 IDR_CHROME_DIRECT_SETTING_JS); | 238 IDR_CHROME_DIRECT_SETTING_JS); |
238 | 239 |
239 // Platform app sources that are not API-specific.. | 240 // Platform app sources that are not API-specific.. |
240 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); | 241 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); |
| 242 source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); |
241 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); | 243 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); |
242 source_map->RegisterSource("webViewInternal", | 244 source_map->RegisterSource("webViewInternal", |
243 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 245 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); |
244 // Note: webView not webview so that this doesn't interfere with the | 246 // Note: webView not webview so that this doesn't interfere with the |
245 // chrome.webview API bindings. | 247 // chrome.webview API bindings. |
246 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); | 248 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); |
247 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); | 249 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); |
248 source_map->RegisterSource("webViewExperimental", | 250 source_map->RegisterSource("webViewExperimental", |
249 IDR_WEB_VIEW_EXPERIMENTAL_JS); | 251 IDR_WEB_VIEW_EXPERIMENTAL_JS); |
250 source_map->RegisterSource("webViewRequest", | 252 source_map->RegisterSource("webViewRequest", |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 306 |
305 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { | 307 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { |
306 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && | 308 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && |
307 extension->permissions_data()->HasAPIPermission( | 309 extension->permissions_data()->HasAPIPermission( |
308 extensions::APIPermission::kAppView)) { | 310 extensions::APIPermission::kAppView)) { |
309 module_system->Require("appView"); | 311 module_system->Require("appView"); |
310 } else { | 312 } else { |
311 module_system->Require("denyAppView"); | 313 module_system->Require("denyAppView"); |
312 } | 314 } |
313 } | 315 } |
| 316 |
| 317 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && |
| 318 extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() && |
| 319 extension->permissions_data()->HasAPIPermission( |
| 320 extensions::APIPermission::kEmbeddedExtensionOptions)) { |
| 321 module_system->Require("extensionOptions"); |
| 322 } |
314 } | 323 } |
315 | 324 |
316 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 325 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
317 const std::set<std::string>& extension_ids) { | 326 const std::set<std::string>& extension_ids) { |
318 // In single-process mode, the browser process reports the active extensions. | 327 // In single-process mode, the browser process reports the active extensions. |
319 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) | 328 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) |
320 return; | 329 return; |
321 crash_keys::SetActiveExtensions(extension_ids); | 330 crash_keys::SetActiveExtensions(extension_ids); |
322 } | 331 } |
323 | 332 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 new extensions::PermissionSet(extensions::APIPermissionSet(), | 375 new extensions::PermissionSet(extensions::APIPermissionSet(), |
367 extensions::ManifestPermissionSet(), | 376 extensions::ManifestPermissionSet(), |
368 origin_set, | 377 origin_set, |
369 extensions::URLPatternSet())); | 378 extensions::URLPatternSet())); |
370 } | 379 } |
371 | 380 |
372 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 381 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
373 bool webrequest_used) { | 382 bool webrequest_used) { |
374 webrequest_used_ = webrequest_used; | 383 webrequest_used_ = webrequest_used; |
375 } | 384 } |
OLD | NEW |