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

Unified Diff: chrome/browser/extensions/extension_util.cc

Issue 480133002: Only show the checkbox for all urls when the switch is on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/browser/extensions/extension_util.h ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 6d86ca7068e16367d99c0f07cf2d66947060cdde..5400fa115c55668b1f3842fe7ff635196464d0f7 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -22,9 +22,11 @@
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
+#include "extensions/common/feature_switch.h"
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -204,6 +206,18 @@ void SetAllowedScriptingOnAllUrls(const std::string& extension_id,
}
}
+bool ScriptsMayRequireActionForExtension(const Extension* extension) {
+ // An extension requires user action to execute scripts iff the switch to do
+ // so is enabled, the extension shows up in chrome:extensions (so the user can
+ // grant withheld permissions), the extension is not part of chrome or
+ // corporate policy, and also not on the scripting whitelist.
+ return FeatureSwitch::scripts_require_action()->IsEnabled() &&
+ extension->ShouldDisplayInExtensionSettings() &&
+ !Manifest::IsPolicyLocation(extension->location()) &&
+ !Manifest::IsComponentLocation(extension->location()) &&
+ !PermissionsData::CanExecuteScriptEverywhere(extension);
+}
+
bool IsAppLaunchable(const std::string& extension_id,
content::BrowserContext* context) {
int reason = ExtensionPrefs::Get(context)->GetDisableReasons(extension_id);
« no previous file with comments | « chrome/browser/extensions/extension_util.h ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698