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

Side by Side Diff: chrome/common/extensions/permissions/permission_set.h

Issue 18399007: Don't count host permission changes for v2 apps as a permission increase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // Returns true if this permission set includes effective access to |url|. 120 // Returns true if this permission set includes effective access to |url|.
121 bool HasEffectiveAccessToURL(const GURL& url) const; 121 bool HasEffectiveAccessToURL(const GURL& url) const;
122 122
123 // Returns ture if this permission set effectively represents full access 123 // Returns ture if this permission set effectively represents full access
124 // (e.g. native code). 124 // (e.g. native code).
125 bool HasEffectiveFullAccess() const; 125 bool HasEffectiveFullAccess() const;
126 126
127 // Returns true if |permissions| has a greater privilege level than this 127 // Returns true if |permissions| has a greater privilege level than this
128 // permission set (e.g., this permission set has less permissions). 128 // permission set (e.g., this permission set has less permissions).
129 bool HasLessPrivilegesThan(const PermissionSet* permissions) const; 129 // Whether certain permissions are considered varies by extension type.
130 bool HasLessPrivilegesThan(const PermissionSet* permissions,
131 Manifest::Type extension_type) const;
130 132
131 const APIPermissionSet& apis() const { return apis_; } 133 const APIPermissionSet& apis() const { return apis_; }
132 134
133 const URLPatternSet& effective_hosts() const { return effective_hosts_; } 135 const URLPatternSet& effective_hosts() const { return effective_hosts_; }
134 136
135 const URLPatternSet& explicit_hosts() const { return explicit_hosts_; } 137 const URLPatternSet& explicit_hosts() const { return explicit_hosts_; }
136 138
137 const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; } 139 const URLPatternSet& scriptable_hosts() const { return scriptable_hosts_; }
138 140
139 private: 141 private:
(...skipping 23 matching lines...) Expand all
163 void InitImplicitPermissions(); 165 void InitImplicitPermissions();
164 166
165 // Initializes the effective host permission based on the data in this set. 167 // Initializes the effective host permission based on the data in this set.
166 void InitEffectiveHosts(); 168 void InitEffectiveHosts();
167 169
168 // Gets the permission messages for the API permissions. 170 // Gets the permission messages for the API permissions.
169 std::set<PermissionMessage> GetSimplePermissionMessages() const; 171 std::set<PermissionMessage> GetSimplePermissionMessages() const;
170 172
171 // Returns true if |permissions| has an elevated API privilege level than 173 // Returns true if |permissions| has an elevated API privilege level than
172 // this set. 174 // this set.
173 bool HasLessAPIPrivilegesThan( 175 bool HasLessAPIPrivilegesThan(const PermissionSet* permissions) const;
174 const PermissionSet* permissions) const;
175 176
176 // Returns true if |permissions| has more host permissions compared to this 177 // Returns true if |permissions| has more host permissions compared to this
177 // set. 178 // set.
178 bool HasLessHostPrivilegesThan( 179 bool HasLessHostPrivilegesThan(const PermissionSet* permissions,
179 const PermissionSet* permissions) const; 180 Manifest::Type extension_type) const;
180 181
181 // Gets a list of the distinct hosts for displaying to the user. 182 // Gets a list of the distinct hosts for displaying to the user.
182 // NOTE: do not use this for comparing permissions, since this disgards some 183 // NOTE: do not use this for comparing permissions, since this disgards some
183 // information. 184 // information.
184 std::set<std::string> GetDistinctHostsForDisplay() const; 185 std::set<std::string> GetDistinctHostsForDisplay() const;
185 186
186 // The api list is used when deciding if an extension can access certain 187 // The api list is used when deciding if an extension can access certain
187 // extension APIs and features. 188 // extension APIs and features.
188 APIPermissionSet apis_; 189 APIPermissionSet apis_;
189 190
190 // The list of hosts that can be accessed directly from the extension. 191 // The list of hosts that can be accessed directly from the extension.
191 // TODO(jstritar): Rename to "hosts_"? 192 // TODO(jstritar): Rename to "hosts_"?
192 URLPatternSet explicit_hosts_; 193 URLPatternSet explicit_hosts_;
193 194
194 // The list of hosts that can be scripted by content scripts. 195 // The list of hosts that can be scripted by content scripts.
195 // TODO(jstritar): Rename to "user_script_hosts_"? 196 // TODO(jstritar): Rename to "user_script_hosts_"?
196 URLPatternSet scriptable_hosts_; 197 URLPatternSet scriptable_hosts_;
197 198
198 // The list of hosts this effectively grants access to. 199 // The list of hosts this effectively grants access to.
199 URLPatternSet effective_hosts_; 200 URLPatternSet effective_hosts_;
200 }; 201 };
201 202
202 } // namespace extensions 203 } // namespace extensions
203 204
204 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_ 205 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_PERMISSION_SET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698