diff options
author | treib <treib@chromium.org> | 2015-08-27 10:33:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 17:34:39 +0000 |
commit | f9dce31fe5e41a1ae949efd15c3f04859c8f989b (patch) | |
tree | c78687e343aca593d9d2fa37372b2f164744e62c /extensions/common/permissions | |
parent | b60e4b98c9786aed73e09ccdc7ef270d4212db89 (diff) | |
download | chromium_src-f9dce31fe5e41a1ae949efd15c3f04859c8f989b.zip chromium_src-f9dce31fe5e41a1ae949efd15c3f04859c8f989b.tar.gz chromium_src-f9dce31fe5e41a1ae949efd15c3f04859c8f989b.tar.bz2 |
Rename CoalescedPermissionMessage to PermissionMessage
It's now the only kind of permission message :)
TBRing a bunch of trivial renames in c/b/ui.
TBR=sky@chromium.org
BUG=398257
Review URL: https://codereview.chromium.org/1309143003
Cr-Commit-Position: refs/heads/master@{#345913}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r-- | extensions/common/permissions/manifest_permission.h | 1 | ||||
-rw-r--r-- | extensions/common/permissions/permission_message.cc (renamed from extensions/common/permissions/coalesced_permission_message.cc) | 18 | ||||
-rw-r--r-- | extensions/common/permissions/permission_message.h (renamed from extensions/common/permissions/coalesced_permission_message.h) | 36 | ||||
-rw-r--r-- | extensions/common/permissions/permission_message_provider.h | 4 | ||||
-rw-r--r-- | extensions/common/permissions/permission_message_test_util.cc | 16 | ||||
-rw-r--r-- | extensions/common/permissions/permission_message_util.cc | 4 | ||||
-rw-r--r-- | extensions/common/permissions/permissions_data.cc | 4 | ||||
-rw-r--r-- | extensions/common/permissions/permissions_data.h | 5 |
8 files changed, 39 insertions, 49 deletions
diff --git a/extensions/common/permissions/manifest_permission.h b/extensions/common/permissions/manifest_permission.h index 6bb5be6..7d21957 100644 --- a/extensions/common/permissions/manifest_permission.h +++ b/extensions/common/permissions/manifest_permission.h @@ -10,7 +10,6 @@ #include "base/memory/scoped_ptr.h" #include "base/pickle.h" #include "extensions/common/permissions/api_permission_set.h" -#include "extensions/common/permissions/coalesced_permission_message.h" namespace base { class PickleIterator; diff --git a/extensions/common/permissions/coalesced_permission_message.cc b/extensions/common/permissions/permission_message.cc index 8239ebe..416b6c9 100644 --- a/extensions/common/permissions/coalesced_permission_message.cc +++ b/extensions/common/permissions/permission_message.cc @@ -2,24 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "extensions/common/permissions/coalesced_permission_message.h" +#include "extensions/common/permissions/permission_message.h" namespace extensions { -CoalescedPermissionMessage::CoalescedPermissionMessage( - const base::string16& message, - const PermissionIDSet& permissions) - : message_(message), permissions_(permissions) { -} +PermissionMessage::PermissionMessage(const base::string16& message, + const PermissionIDSet& permissions) + : message_(message), permissions_(permissions) {} -CoalescedPermissionMessage::CoalescedPermissionMessage( +PermissionMessage::PermissionMessage( const base::string16& message, const PermissionIDSet& permissions, const std::vector<base::string16>& submessages) - : message_(message), permissions_(permissions), submessages_(submessages) { -} + : message_(message), permissions_(permissions), submessages_(submessages) {} -CoalescedPermissionMessage::~CoalescedPermissionMessage() { -} +PermissionMessage::~PermissionMessage() {} } // namespace extensions diff --git a/extensions/common/permissions/coalesced_permission_message.h b/extensions/common/permissions/permission_message.h index 2848091..bdb053a 100644 --- a/extensions/common/permissions/coalesced_permission_message.h +++ b/extensions/common/permissions/permission_message.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef EXTENSIONS_COMMON_PERMISSIONS_COALESCED_PERMISSION_MESSAGE_H_ -#define EXTENSIONS_COMMON_PERMISSIONS_COALESCED_PERMISSION_MESSAGE_H_ +#ifndef EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ +#define EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ #include <list> #include <string> @@ -15,10 +15,10 @@ namespace extensions { // The new kind of Chrome app/extension permission messages. // -// A CoalescedPermissionMessage is an immutable object that represents a single -// bullet in the list of an app or extension's permissions. It contains the -// localized permission message to display, as well as the set of permissions -// that contributed to that message (and should be revoked if this permission is +// A PermissionMessage is an immutable object that represents a single bullet +// in the list of an app or extension's permissions. It contains the localized +// permission message to display, as well as the set of permissions that +// contributed to that message (and should be revoked if this permission is // revoked). It can also optionally contain a list of sub-messages which should // appear as nested bullet points below the main one. // @@ -26,8 +26,8 @@ namespace extensions { // message and should be revoked if this permission message is revoked. Note // that other permissions could have contributed to the message, but these are // the ones 'contained' in this message - if this set is taken for all -// CoalescedPermissionMessages, each permission will only be in at most one -// CoalescedPermissionMessage. +// PermissionMessages, each permission will only be in at most one +// PermissionMessage. // // Some permissions may contain nested messages, stored in |submessages|. These // are appropriate to show as nested bullet points below the permission, @@ -37,16 +37,14 @@ namespace extensions { // // TODO(sashab): Add a custom revoke action for each permission and nested // permission message, registerable as a callback. -// TODO(sashab): Once the existing PermissionMessage is no longer used, rename -// this to PermissionMessage. -class CoalescedPermissionMessage { +class PermissionMessage { public: - CoalescedPermissionMessage(const base::string16& message, - const PermissionIDSet& permissions); - CoalescedPermissionMessage(const base::string16& message, - const PermissionIDSet& permissions, - const std::vector<base::string16>& submessages); - virtual ~CoalescedPermissionMessage(); + PermissionMessage(const base::string16& message, + const PermissionIDSet& permissions); + PermissionMessage(const base::string16& message, + const PermissionIDSet& permissions, + const std::vector<base::string16>& submessages); + virtual ~PermissionMessage(); const base::string16& message() const { return message_; } const PermissionIDSet& permissions() const { return permissions_; } @@ -62,8 +60,8 @@ class CoalescedPermissionMessage { // TODO(treib): Make this an std::vector when we have C++11 library support on // all platforms. (In C++03, std::vector's elements must be copy-assignable...) -typedef std::list<CoalescedPermissionMessage> CoalescedPermissionMessages; +typedef std::list<PermissionMessage> PermissionMessages; } // namespace extensions -#endif // EXTENSIONS_COMMON_PERMISSIONS_COALESCED_PERMISSION_MESSAGE_H_ +#endif // EXTENSIONS_COMMON_PERMISSIONS_PERMISSION_MESSAGE_H_ diff --git a/extensions/common/permissions/permission_message_provider.h b/extensions/common/permissions/permission_message_provider.h index 0a6b7e0..8981f80 100644 --- a/extensions/common/permissions/permission_message_provider.h +++ b/extensions/common/permissions/permission_message_provider.h @@ -8,7 +8,7 @@ #include <vector> #include "extensions/common/manifest.h" -#include "extensions/common/permissions/coalesced_permission_message.h" +#include "extensions/common/permissions/permission_message.h" namespace extensions { @@ -30,7 +30,7 @@ class PermissionMessageProvider { // |permissions|. This involves converting the given PermissionIDs into // localized messages, as well as coalescing and parameterizing any messages // that require the permission ID's argument in their message. - virtual CoalescedPermissionMessages GetPermissionMessages( + virtual PermissionMessages GetPermissionMessages( const PermissionIDSet& permissions) const = 0; // Returns true if |new_permissions| has a greater privilege level than diff --git a/extensions/common/permissions/permission_message_test_util.cc b/extensions/common/permissions/permission_message_test_util.cc index fb8a5bb..2cf3a5d 100644 --- a/extensions/common/permissions/permission_message_test_util.cc +++ b/extensions/common/permissions/permission_message_test_util.cc @@ -17,8 +17,8 @@ namespace extensions { namespace { -CoalescedPermissionMessages GetMessages(const PermissionSet* permissions, - Manifest::Type extension_type) { +PermissionMessages GetMessages(const PermissionSet* permissions, + Manifest::Type extension_type) { const PermissionMessageProvider* provider = PermissionMessageProvider::Get(); return provider->GetPermissionMessages( provider->GetAllPermissionIDs(permissions, extension_type)); @@ -73,9 +73,9 @@ base::string16 MessagesVectorToString( base::ASCIIToUTF16("\"\n"); } -base::string16 MessagesToString(const CoalescedPermissionMessages& messages) { +base::string16 MessagesToString(const PermissionMessages& messages) { std::vector<base::string16> messages_vec; - for (const CoalescedPermissionMessage& msg : messages) + for (const PermissionMessage& msg : messages) messages_vec.push_back(msg.message()); return MessagesVectorToString(messages_vec); } @@ -107,10 +107,10 @@ bool CheckThatSubmessagesMatch( testing::AssertionResult VerifyHasPermissionMessageImpl( const base::string16& expected_message, const std::vector<base::string16>& expected_submessages, - const CoalescedPermissionMessages& actual_messages) { + const PermissionMessages& actual_messages) { auto message_it = std::find_if(actual_messages.begin(), actual_messages.end(), - [&expected_message](const CoalescedPermissionMessage& msg) { + [&expected_message](const PermissionMessage& msg) { return msg.message() == expected_message; }); bool found = message_it != actual_messages.end(); @@ -135,7 +135,7 @@ testing::AssertionResult VerifyHasPermissionMessageImpl( testing::AssertionResult VerifyPermissionMessagesWithSubmessagesImpl( const std::vector<base::string16>& expected_messages, const std::vector<std::vector<base::string16>>& expected_submessages, - const CoalescedPermissionMessages& actual_messages, + const PermissionMessages& actual_messages, bool check_order) { CHECK_EQ(expected_messages.size(), expected_submessages.size()); if (expected_messages.size() != actual_messages.size()) { @@ -150,7 +150,7 @@ testing::AssertionResult VerifyPermissionMessagesWithSubmessagesImpl( if (check_order) { auto it = actual_messages.begin(); for (size_t i = 0; i < expected_messages.size(); i++, ++it) { - const CoalescedPermissionMessage& actual_message = *it; + const PermissionMessage& actual_message = *it; if (expected_messages[i] != actual_message.message()) { // Message: Expected messages to be { "Foo" }, but got { "Bar", "Baz" } return testing::AssertionFailure() diff --git a/extensions/common/permissions/permission_message_util.cc b/extensions/common/permissions/permission_message_util.cc index ccd4722..566fe85 100644 --- a/extensions/common/permissions/permission_message_util.cc +++ b/extensions/common/permissions/permission_message_util.cc @@ -5,11 +5,9 @@ #include "extensions/common/permissions/permission_message_util.h" #include "base/macros.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/utf_string_conversions.h" -#include "extensions/common/permissions/coalesced_permission_message.h" -#include "extensions/common/permissions/permission_set.h" +#include "extensions/common/permissions/api_permission_set.h" #include "extensions/common/url_pattern_set.h" #include "grit/extensions_strings.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 694ccfc..8e5e4b5 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -13,7 +13,7 @@ #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_util.h" +#include "extensions/common/permissions/permission_message_provider.h" #include "extensions/common/switches.h" #include "extensions/common/url_pattern_set.h" #include "url/gurl.h" @@ -194,7 +194,7 @@ bool PermissionsData::HasEffectiveAccessToAllHosts() const { return active_permissions()->HasEffectiveAccessToAllHosts(); } -CoalescedPermissionMessages PermissionsData::GetPermissionMessages() const { +PermissionMessages PermissionsData::GetPermissionMessages() const { return PermissionMessageProvider::Get()->GetPermissionMessages( PermissionMessageProvider::Get()->GetAllPermissionIDs( active_permissions().get(), manifest_type_)); diff --git a/extensions/common/permissions/permissions_data.h b/extensions/common/permissions/permissions_data.h index 0112210..43be869 100644 --- a/extensions/common/permissions/permissions_data.h +++ b/extensions/common/permissions/permissions_data.h @@ -14,8 +14,7 @@ #include "base/synchronization/lock.h" #include "extensions/common/manifest.h" #include "extensions/common/permissions/api_permission.h" -#include "extensions/common/permissions/coalesced_permission_message.h" -#include "extensions/common/permissions/permission_message_provider.h" +#include "extensions/common/permissions/permission_message.h" #include "extensions/common/permissions/permission_set.h" class GURL; @@ -131,7 +130,7 @@ class PermissionsData { // Returns the full list of permission details for messages that should // display at install time, in a nested format ready for display. - CoalescedPermissionMessages GetPermissionMessages() const; + PermissionMessages GetPermissionMessages() const; // Returns true if the extension has requested all-hosts permissions (or // something close to it), but has had it withheld. |