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

Unified Diff: chrome/common/extensions/permissions/chrome_permission_message_provider.cc

Issue 2086523002: Reinstate evil hack to suppress permission warnings for searchProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 | « no previous file | chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/permissions/chrome_permission_message_provider.cc
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc
index 49db41868c49f98acb4f9484eb1657e2af76b873..ecaaf2d3a784f638746c6de4cbc4e3dda96f83e2 100644
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc
@@ -44,6 +44,15 @@ class ComparablePermission {
};
using ComparablePermissions = std::vector<ComparablePermission>;
+void DropPermissionParameter(APIPermission::ID id,
+ PermissionIDSet* permissions) {
+ if (permissions->ContainsID(id)) {
+ // Erase the permission, and insert it again without a parameter.
+ permissions->erase(id);
+ permissions->insert(id);
+ }
+}
+
} // namespace
typedef std::set<PermissionMessage> PermissionMsgSet;
@@ -176,6 +185,20 @@ bool ChromePermissionMessageProvider::IsAPIOrManifestPrivilegeIncrease(
AddAPIPermissions(new_permissions, &new_ids);
AddManifestPermissions(new_permissions, &new_ids);
+ // Ugly hack: Before M46 beta, we didn't store the parameter for settings
+ // override permissions in prefs (which is where |old_permissions| is coming
+ // from). To avoid a spurious permission increase warning, drop the parameter.
+ // See crbug.com/533086 and crbug.com/619759.
+ // TODO(treib,devlin): Remove this for M56, when hopefully all users will have
+ // updated prefs.
+ const APIPermission::ID kSettingsOverrideIDs[] = {
+ APIPermission::kHomepage, APIPermission::kSearchProvider,
+ APIPermission::kStartupPages};
+ for (auto id : kSettingsOverrideIDs) {
+ DropPermissionParameter(id, &old_ids);
+ DropPermissionParameter(id, &new_ids);
+ }
+
// If all the IDs were already there, it's not a privilege increase.
if (old_ids.Includes(new_ids))
return false;
« no previous file with comments | « no previous file | chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698