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

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

Issue 482953003: Add a separate warning message for topSites permission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
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 2a8b163a8a78ed5c5fba49042993e6e64c8ee000..4492e5c0c7256eb2d0a8647213b3316cebe1cdab 100644
--- a/chrome/common/extensions/permissions/chrome_permission_message_provider.cc
+++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.cc
@@ -81,6 +81,14 @@ ChromePermissionMessageProvider::~ChromePermissionMessageProvider() {
PermissionMessages ChromePermissionMessageProvider::GetPermissionMessages(
const PermissionSet* permissions,
Manifest::Type extension_type) const {
+ PermissionMessages messages;
+ if (permissions->HasEffectiveFullAccess()) {
+ messages.push_back(PermissionMessage(
+ PermissionMessage::kFullAccess,
+ l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS)));
+ return messages;
+ }
+
// Some warnings are more generic and/or powerful and superseed other
// warnings. In that case, the first message suppresses the second one.
std::multimap<PermissionMessage::ID, PermissionMessage::ID> kSuppressList;
@@ -94,6 +102,9 @@ PermissionMessages ChromePermissionMessageProvider::GetPermissionMessages(
// History already allows tabs access.
kSuppressList.insert(
{PermissionMessage::kBrowsingHistory, PermissionMessage::kTabs});
+ // History already allows access the list of most frequently visited sites.
+ kSuppressList.insert(
+ {PermissionMessage::kBrowsingHistory, PermissionMessage::kTopSites});
// A special hack: If kFileSystemWriteDirectory would be displayed, hide
// kFileSystemDirectory as the write directory message implies it.
// TODO(sammc): Remove this. See http://crbug.com/284849.
@@ -102,20 +113,17 @@ PermissionMessages ChromePermissionMessageProvider::GetPermissionMessages(
// Full access already allows DeclarativeWebRequest.
kSuppressList.insert({PermissionMessage::kHostsAll,
PermissionMessage::kDeclarativeWebRequest});
+ // Full access implies reading the list of most frequently visited sites.
+ kSuppressList.insert(
+ {PermissionMessage::kHostsAll, PermissionMessage::kTopSites});
// Full access already covers tabs access.
kSuppressList.insert(
{PermissionMessage::kHostsAll, PermissionMessage::kTabs});
// Tabs already allows reading favicons.
kSuppressList.insert({PermissionMessage::kTabs, PermissionMessage::kFavicon});
-
- PermissionMessages messages;
-
- if (permissions->HasEffectiveFullAccess()) {
- messages.push_back(PermissionMessage(
- PermissionMessage::kFullAccess,
- l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS)));
- return messages;
- }
+ // Tabs already allows reading the list of most frequently visited sites.
+ kSuppressList.insert(
+ {PermissionMessage::kTabs, PermissionMessage::kTopSites});
PermissionMsgSet host_msgs =
GetHostPermissionMessages(permissions, extension_type);

Powered by Google App Engine
This is Rietveld 408576698