Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2261)

Unified Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 512543002: Model <webview> and <appview> script injection after <extensionoptions> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add permission dependency to whitelist Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/_api_features.json ('k') | extensions/common/feature_switch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
diff --git a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
index ccbff5e6d5a12a416987da0408a3fdddb8cfc69c..0e0fefaec91f7fdedc6044c75f5c02606324ac18 100644
--- a/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
+++ b/chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc
@@ -272,51 +272,21 @@ void ChromeExtensionsDispatcherDelegate::RequireAdditionalModules(
module_system->Require("windowControls");
}
- const extensions::Extension* extension = context->extension();
-
- // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
- // apps. An ext/app runs in a blessed extension context, if it is the active
- // extension in the current process, in other words, if it is loaded in a top
- // frame. To support webview in a non-frame extension, we have to allow
- // unblessed extension context as well.
// Note: setting up the WebView class here, not the chrome.webview API.
// The API will be automatically set up when first used.
- if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT ||
- context_type == extensions::Feature::UNBLESSED_EXTENSION_CONTEXT) {
- // TODO(fsamuel): Use context->GetAvailability("webViewInternal").
- if (extension->permissions_data()->HasAPIPermission(
- extensions::APIPermission::kWebView)) {
- module_system->Require("webView");
- if (extensions::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) {
- module_system->Require("webViewExperimental");
- } else {
- // TODO(asargent) We need a whitelist for webview experimental.
- // crbug.com/264852
- std::string id_hash = base::SHA1HashString(extension->id());
- std::string hexencoded_id_hash =
- base::HexEncode(id_hash.c_str(), id_hash.length());
- if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" ||
- hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
- hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
- hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") {
- module_system->Require("webViewExperimental");
- }
- }
- } else {
- module_system->Require("denyWebView");
- }
+ if (context->GetAvailability("webViewInternal").is_available()) {
+ module_system->Require("webView");
+ if (context->GetAvailability("webViewExperimentalInternal").is_available())
+ module_system->Require("webViewExperimental");
+ } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
+ module_system->Require("denyWebView");
}
- if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
- // TODO(fsamuel): Use context->GetAvailability("appViewInternal").
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- extensions::switches::kEnableAppView) &&
- extension->permissions_data()->HasAPIPermission(
- extensions::APIPermission::kAppView)) {
- module_system->Require("appView");
- } else {
- module_system->Require("denyAppView");
- }
+ if (extensions::FeatureSwitch::app_view()->IsEnabled() &&
+ context->GetAvailability("appViewEmbedderInternal").is_available()) {
+ module_system->Require("appView");
+ } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) {
+ module_system->Require("denyAppView");
}
if (extensions::FeatureSwitch::embedded_extension_options()->IsEnabled() &&
« no previous file with comments | « chrome/common/extensions/api/_api_features.json ('k') | extensions/common/feature_switch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698