| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Custom types sources. | 235 // Custom types sources. |
| 235 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); | 236 source_map->RegisterSource("ChromeSetting", IDR_CHROME_SETTING_JS); |
| 236 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); | 237 source_map->RegisterSource("ContentSetting", IDR_CONTENT_SETTING_JS); |
| 237 source_map->RegisterSource("ChromeDirectSetting", | 238 source_map->RegisterSource("ChromeDirectSetting", |
| 238 IDR_CHROME_DIRECT_SETTING_JS); | 239 IDR_CHROME_DIRECT_SETTING_JS); |
| 239 | 240 |
| 240 // Platform app sources that are not API-specific.. | 241 // Platform app sources that are not API-specific.. |
| 241 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); | 242 source_map->RegisterSource("appView", IDR_APP_VIEW_JS); |
| 242 source_map->RegisterSource("fileEntryBindingUtil", | 243 source_map->RegisterSource("fileEntryBindingUtil", |
| 243 IDR_FILE_ENTRY_BINDING_UTIL_JS); | 244 IDR_FILE_ENTRY_BINDING_UTIL_JS); |
| 245 source_map->RegisterSource("extensionOptions", IDR_EXTENSION_OPTIONS_JS); |
| 244 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); | 246 source_map->RegisterSource("tagWatcher", IDR_TAG_WATCHER_JS); |
| 245 source_map->RegisterSource("webViewInternal", | 247 source_map->RegisterSource("webViewInternal", |
| 246 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); | 248 IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); |
| 247 // Note: webView not webview so that this doesn't interfere with the | 249 // Note: webView not webview so that this doesn't interfere with the |
| 248 // chrome.webview API bindings. | 250 // chrome.webview API bindings. |
| 249 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); | 251 source_map->RegisterSource("webView", IDR_WEB_VIEW_JS); |
| 250 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); | 252 source_map->RegisterSource("webViewEvents", IDR_WEB_VIEW_EVENTS_JS); |
| 251 source_map->RegisterSource("webViewExperimental", | 253 source_map->RegisterSource("webViewExperimental", |
| 252 IDR_WEB_VIEW_EXPERIMENTAL_JS); | 254 IDR_WEB_VIEW_EXPERIMENTAL_JS); |
| 253 source_map->RegisterSource("webViewRequest", | 255 source_map->RegisterSource("webViewRequest", |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 309 |
| 308 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { | 310 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { |
| 309 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && | 311 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppView) && |
| 310 extension->permissions_data()->HasAPIPermission( | 312 extension->permissions_data()->HasAPIPermission( |
| 311 extensions::APIPermission::kAppView)) { | 313 extensions::APIPermission::kAppView)) { |
| 312 module_system->Require("appView"); | 314 module_system->Require("appView"); |
| 313 } else { | 315 } else { |
| 314 module_system->Require("denyAppView"); | 316 module_system->Require("denyAppView"); |
| 315 } | 317 } |
| 316 } | 318 } |
| 319 |
| 320 if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT && |
| 321 extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() && |
| 322 extension->permissions_data()->HasAPIPermission( |
| 323 extensions::APIPermission::kEmbeddedExtensionOptions)) { |
| 324 module_system->Require("extensionOptions"); |
| 325 } |
| 317 } | 326 } |
| 318 | 327 |
| 319 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( | 328 void ChromeExtensionsDispatcherDelegate::OnActiveExtensionsUpdated( |
| 320 const std::set<std::string>& extension_ids) { | 329 const std::set<std::string>& extension_ids) { |
| 321 // In single-process mode, the browser process reports the active extensions. | 330 // In single-process mode, the browser process reports the active extensions. |
| 322 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) | 331 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kSingleProcess)) |
| 323 return; | 332 return; |
| 324 crash_keys::SetActiveExtensions(extension_ids); | 333 crash_keys::SetActiveExtensions(extension_ids); |
| 325 } | 334 } |
| 326 | 335 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 new extensions::PermissionSet(extensions::APIPermissionSet(), | 378 new extensions::PermissionSet(extensions::APIPermissionSet(), |
| 370 extensions::ManifestPermissionSet(), | 379 extensions::ManifestPermissionSet(), |
| 371 origin_set, | 380 origin_set, |
| 372 extensions::URLPatternSet())); | 381 extensions::URLPatternSet())); |
| 373 } | 382 } |
| 374 | 383 |
| 375 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( | 384 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( |
| 376 bool webrequest_used) { | 385 bool webrequest_used) { |
| 377 webrequest_used_ = webrequest_used; | 386 webrequest_used_ = webrequest_used; |
| 378 } | 387 } |
| OLD | NEW |