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

Unified Diff: extensions/common/permissions/permissions_data.cc

Issue 922403002: [Extensions] Adjust script injection reporting to the browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « extensions/common/permissions/permissions_data.h ('k') | extensions/renderer/extension_injection_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/permissions/permissions_data.cc
diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc
index 693a39e2d32ba4f448a00521fa40dc526d670da8..2b33f0c366c4aa0a54dd4fbe4ddc45c686b737c7 100644
--- a/extensions/common/permissions/permissions_data.cc
+++ b/extensions/common/permissions/permissions_data.cc
@@ -10,6 +10,7 @@
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extensions_client.h"
+#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/permission_message_provider.h"
@@ -65,6 +66,21 @@ bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) {
whitelist.end();
}
+// static
+bool PermissionsData::ScriptsMayRequireActionForExtension(
+ const Extension* extension,
+ const PermissionSet* permissions) {
+ // An extension may require user action to execute scripts iff the extension
+ // shows up in chrome:extensions (so the user can grant withheld permissions),
+ // is not part of chrome or corporate policy, not on the scripting whitelist,
+ // and requires enough permissions that we should withhold them.
+ return extension->ShouldDisplayInExtensionSettings() &&
+ !Manifest::IsPolicyLocation(extension->location()) &&
+ !Manifest::IsComponentLocation(extension->location()) &&
+ !CanExecuteScriptEverywhere(extension) &&
+ permissions->ShouldWarnAllHosts();
+}
+
bool PermissionsData::ShouldSkipPermissionWarnings(
const std::string& extension_id) {
// See http://b/4946060 for more details.
« no previous file with comments | « extensions/common/permissions/permissions_data.h ('k') | extensions/renderer/extension_injection_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698