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

Unified Diff: chrome/common/extensions/extension_permission_set.h

Issue 10049006: Add OAuth2 scopes to the ExtensionPermissionSet and granted permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/extension_permission_set.h
diff --git a/chrome/common/extensions/extension_permission_set.h b/chrome/common/extensions/extension_permission_set.h
index 3b468ca4f28011bfed7f176a63ec9acd86a8918c..aac5ffca133bb3452a897f4e5edfaf77778c47c5 100644
--- a/chrome/common/extensions/extension_permission_set.h
+++ b/chrome/common/extensions/extension_permission_set.h
@@ -11,6 +11,7 @@
#include <string>
#include <vector>
+#include "base/callback.h"
Yoyo Zhou 2012/04/24 23:16:36 You don't seem to use this.
jstritar 2012/04/24 23:33:34 Done.
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -272,12 +273,15 @@ class ExtensionPermissionsInfo {
DISALLOW_COPY_AND_ASSIGN(ExtensionPermissionsInfo);
};
+typedef std::set<std::string> ExtensionOAuth2Scopes;
+
// The ExtensionPermissionSet is an immutable class that encapsulates an
// extension's permissions. The class exposes set operations for combining and
// manipulating the permissions.
class ExtensionPermissionSet
: public base::RefCountedThreadSafe<ExtensionPermissionSet> {
public:
+
Yoyo Zhou 2012/04/24 23:16:36 nit: why this extra line?
jstritar 2012/04/24 23:33:34 Done.
// Creates an empty permission set (e.g. default permissions).
ExtensionPermissionSet();
@@ -287,13 +291,24 @@ class ExtensionPermissionSet
// manifest, |apis| and |hosts|.
ExtensionPermissionSet(const Extension* extension,
const ExtensionAPIPermissionSet& apis,
- const URLPatternSet& explicit_hosts);
+ const URLPatternSet& explicit_hosts,
+ const ExtensionOAuth2Scopes& scopes);
+
// Creates a new permission set based on the specified data.
ExtensionPermissionSet(const ExtensionAPIPermissionSet& apis,
const URLPatternSet& explicit_hosts,
const URLPatternSet& scriptable_hosts);
+ // Creates a new permission set that has oauth scopes in it.
+ ExtensionPermissionSet(const ExtensionAPIPermissionSet& apis,
+ const URLPatternSet& explicit_hosts,
+ const URLPatternSet& scriptable_hosts,
+ const ExtensionOAuth2Scopes& scopes);
+
+ // Creates a new permission set containing only oauth scopes.
+ explicit ExtensionPermissionSet(const ExtensionOAuth2Scopes& scopes);
+
~ExtensionPermissionSet();
// Creates a new permission set equal to |set1| - |set2|, passing ownership of
@@ -382,6 +397,8 @@ class ExtensionPermissionSet
const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; }
+ const ExtensionOAuth2Scopes& scopes() const { return scopes_; }
+
private:
FRIEND_TEST_ALL_PREFIXES(ExtensionPermissionsTest,
HasLessHostPrivilegesThan);
@@ -412,6 +429,9 @@ class ExtensionPermissionSet
bool HasLessHostPrivilegesThan(
const ExtensionPermissionSet* permissions) const;
+ // Returns true if |permissions| has more oauth2 scopes compared to this set.
+ bool HasLessScopesThan(const ExtensionPermissionSet* permissions) const;
+
// The api list is used when deciding if an extension can access certain
// extension APIs and features.
ExtensionAPIPermissionSet apis_;
@@ -426,6 +446,9 @@ class ExtensionPermissionSet
// The list of hosts this effectively grants access to.
URLPatternSet effective_hosts_;
+
+ // A set of oauth2 scopes that are specific to Google Accounts.
Yoyo Zhou 2012/04/24 23:16:36 Can you elaborate on what these are used for in th
jstritar 2012/04/24 23:33:34 Done.
+ ExtensionOAuth2Scopes scopes_;
};
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_

Powered by Google App Engine
This is Rietveld 408576698