diff options
author | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-18 22:03:54 +0000 |
---|---|---|
committer | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-18 22:05:37 +0000 |
commit | 4d67e9d1cd9385676e15ea1bc7c7c6d0d97cb95d (patch) | |
tree | af541f29bb93faefe5a444053465f57c6f61ddf9 /chrome/browser/extensions/extension_util.cc | |
parent | 35700f0cb6a631937d55a212f2b75e2c35459d9d (diff) | |
download | chromium_src-4d67e9d1cd9385676e15ea1bc7c7c6d0d97cb95d.zip chromium_src-4d67e9d1cd9385676e15ea1bc7c7c6d0d97cb95d.tar.gz chromium_src-4d67e9d1cd9385676e15ea1bc7c7c6d0d97cb95d.tar.bz2 |
Only show the checkbox for all urls when the switch is on
BUG=402958
Review URL: https://codereview.chromium.org/480133002
Cr-Commit-Position: refs/heads/master@{#290372}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_util.cc')
-rw-r--r-- | chrome/browser/extensions/extension_util.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc index 6d86ca7..5400fa1 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); |