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

Side by Side Diff: chrome/common/extensions/extension_permission_set.h

Issue 9460002: Convert app_bindings.js to the schema_generated_bindings.js infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix koz bool thing Created 8 years, 9 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_EXTENSION_PERMISSION_SET_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Extension::TYPE_PLATFORM_APP 174 // Extension::TYPE_PLATFORM_APP
175 kTypePlatformApp = 1 << 3, 175 kTypePlatformApp = 1 << 3,
176 176
177 // Supports all types. 177 // Supports all types.
178 kTypeAll = (1 << 4) - 1, 178 kTypeAll = (1 << 4) - 1,
179 179
180 // Convenience flag for all types except hosted apps. 180 // Convenience flag for all types except hosted apps.
181 kTypeDefault = kTypeAll - kTypeHostedApp, 181 kTypeDefault = kTypeAll - kTypeHostedApp,
182 }; 182 };
183 183
184 typedef std::set<ID> IDSet;
185
186 ~ExtensionAPIPermission(); 184 ~ExtensionAPIPermission();
187 185
188 // Returns the localized permission message associated with this api. 186 // Returns the localized permission message associated with this api.
189 ExtensionPermissionMessage GetMessage() const; 187 ExtensionPermissionMessage GetMessage() const;
190 188
191 int flags() const { return flags_; } 189 int flags() const { return flags_; }
192 190
193 int type_restrictions() const { return type_restrictions_; } 191 int type_restrictions() const { return type_restrictions_; }
194 192
195 ID id() const { return id_; } 193 ID id() const { return id_; }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2); 383 const ExtensionPermissionSet* set1, const ExtensionPermissionSet* set2);
386 384
387 bool operator==(const ExtensionPermissionSet& rhs) const; 385 bool operator==(const ExtensionPermissionSet& rhs) const;
388 386
389 // Returns true if |set| is a subset of this. 387 // Returns true if |set| is a subset of this.
390 bool Contains(const ExtensionPermissionSet& set) const; 388 bool Contains(const ExtensionPermissionSet& set) const;
391 389
392 // Gets the API permissions in this set as a set of strings. 390 // Gets the API permissions in this set as a set of strings.
393 std::set<std::string> GetAPIsAsStrings() const; 391 std::set<std::string> GetAPIsAsStrings() const;
394 392
393 // Gets the API permissions in this set, plus any that have implicit access
394 // (such as APIs that require no permissions, or APIs with functions that
395 // require no permissions).
396 // TODO(kalman): return scoped_ptr to avoid copying.
397 std::set<std::string> GetAPIsWithAnyAccessAsStrings() const;
398
395 // Returns whether this namespace has any functions which the extension has 399 // Returns whether this namespace has any functions which the extension has
396 // permission to use. For example, even though the extension may not have 400 // permission to use. For example, even though the extension may not have
397 // the "tabs" permission, "tabs.create" requires no permissions so 401 // the "tabs" permission, "tabs.create" requires no permissions so
398 // HasAnyAPIPermission("tabs") will return true. 402 // HasAnyAPIPermission("tabs") will return true.
399 bool HasAnyAccessToAPI(const std::string& api_name) const; 403 bool HasAnyAccessToAPI(const std::string& api_name) const;
400 404
401 // Gets a list of the distinct hosts for displaying to the user. 405 // Gets a list of the distinct hosts for displaying to the user.
402 // NOTE: do not use this for comparing permissions, since this disgards some 406 // NOTE: do not use this for comparing permissions, since this disgards some
403 // information. 407 // information.
404 std::set<std::string> GetDistinctHostsForDisplay() const; 408 std::set<std::string> GetDistinctHostsForDisplay() const;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 497
494 // The list of hosts that can be scripted by content scripts. 498 // The list of hosts that can be scripted by content scripts.
495 // TODO(jstritar): Rename to "user_script_hosts_"? 499 // TODO(jstritar): Rename to "user_script_hosts_"?
496 URLPatternSet scriptable_hosts_; 500 URLPatternSet scriptable_hosts_;
497 501
498 // The list of hosts this effectively grants access to. 502 // The list of hosts this effectively grants access to.
499 URLPatternSet effective_hosts_; 503 URLPatternSet effective_hosts_;
500 }; 504 };
501 505
502 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 506 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698