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

Unified Diff: chrome/common/extensions/permissions/permission_set.h

Issue 10837060: Don't show host permission warnings for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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/permission_set.h
diff --git a/chrome/common/extensions/permissions/permission_set.h b/chrome/common/extensions/permissions/permission_set.h
index 76d652138f81e1b45150d5664499255a6a8ad3a0..85475feede832a50fc60413e64a9e9d55f43d611 100644
--- a/chrome/common/extensions/permissions/permission_set.h
+++ b/chrome/common/extensions/permissions/permission_set.h
@@ -14,14 +14,13 @@
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/string16.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/permissions/api_permission.h"
#include "chrome/common/extensions/permissions/permission_message.h"
#include "chrome/common/extensions/url_pattern_set.h"
namespace extensions {
-class Extension;
-
// The PermissionSet is an immutable class that encapsulates an
// extension's permissions. The class exposes set operations for combining and
// manipulating the permissions.
@@ -78,17 +77,15 @@ class PermissionSet
// HasAnyAPIPermission("tabs") will return true.
bool HasAnyAccessToAPI(const std::string& api_name) const;
- // Gets a list of the distinct hosts for displaying to the user.
- // NOTE: do not use this for comparing permissions, since this disgards some
- // information.
- std::set<std::string> GetDistinctHostsForDisplay() const;
-
// Gets the localized permission messages that represent this set.
- PermissionMessages GetPermissionMessages() const;
+ // The set of permission messages shown varies by extension type.
+ PermissionMessages GetPermissionMessages(Extension::Type extension_type)
+ const;
// Gets the localized permission messages that represent this set (represented
- // as strings).
- std::vector<string16> GetWarningMessages() const;
+ // as strings). The set of permission messages shown varies by extension type.
+ std::vector<string16> GetWarningMessages(Extension::Type extension_type)
+ const;
// Returns true if this is an empty set (e.g., the default permission set).
bool IsEmpty() const;
@@ -132,6 +129,15 @@ class PermissionSet
private:
FRIEND_TEST_ALL_PREFIXES(PermissionsTest, HasLessHostPrivilegesThan);
FRIEND_TEST_ALL_PREFIXES(PermissionsTest, GetWarningMessages_AudioVideo);
+ FRIEND_TEST_ALL_PREFIXES(PermissionsTest, GetDistinctHostsForDisplay);
+ FRIEND_TEST_ALL_PREFIXES(PermissionsTest,
+ GetDistinctHostsForDisplay_ComIsBestRcd);
+ FRIEND_TEST_ALL_PREFIXES(PermissionsTest,
+ GetDistinctHostsForDisplay_NetIs2ndBestRcd);
+ FRIEND_TEST_ALL_PREFIXES(PermissionsTest,
+ GetDistinctHostsForDisplay_OrgIs3rdBestRcd);
+ FRIEND_TEST_ALL_PREFIXES(PermissionsTest,
+ GetDistinctHostsForDisplay_FirstInListIs4thBestRcd);
friend class base::RefCountedThreadSafe<PermissionSet>;
~PermissionSet();
@@ -163,6 +169,11 @@ class PermissionSet
bool HasLessHostPrivilegesThan(
const PermissionSet* permissions) const;
+ // Gets a list of the distinct hosts for displaying to the user.
+ // NOTE: do not use this for comparing permissions, since this disgards some
+ // information.
+ std::set<std::string> GetDistinctHostsForDisplay() const;
+
// The api list is used when deciding if an extension can access certain
// extension APIs and features.
APIPermissionSet apis_;
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/permissions/permission_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698