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

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
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..6dedaaaa12bffb79f1bdb86f4ff4af4db6c8abe3 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,20 @@ bool PermissionsData::CanExecuteScriptEverywhere(const Extension* extension) {
whitelist.end();
}
+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.

Powered by Google App Engine
This is Rietveld 408576698