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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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
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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "chrome/common/extensions/url_pattern_set.h" 18 #include "chrome/common/extensions/url_pattern_set.h"
19 19
20 // TODO(jstritar): Move each class to its own file in extensions/permissions. 20 // TODO(jstritar): Move each class to its own file in extensions/permissions.
21 21
22 class ExtensionPermissionsInfo;
23
24 namespace extensions {
22 class Extension; 25 class Extension;
23 class ExtensionPermissionsInfo; 26 }
24 27
25 // When prompting the user to install or approve permissions, we display 28 // When prompting the user to install or approve permissions, we display
26 // messages describing the effects of the permissions rather than listing the 29 // messages describing the effects of the permissions rather than listing the
27 // permissions themselves. Each ExtensionPermissionMessage represents one of the 30 // permissions themselves. Each ExtensionPermissionMessage represents one of the
28 // messages shown to the user. 31 // messages shown to the user.
29 class ExtensionPermissionMessage { 32 class ExtensionPermissionMessage {
30 public: 33 public:
31 // Do not reorder this enumeration. If you need to add a new enum, add it just 34 // Do not reorder this enumeration. If you need to add a new enum, add it just
32 // prior to kEnumBoundary. 35 // prior to kEnumBoundary.
33 enum ID { 36 enum ID {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 class ExtensionPermissionSet 286 class ExtensionPermissionSet
284 : public base::RefCountedThreadSafe<ExtensionPermissionSet> { 287 : public base::RefCountedThreadSafe<ExtensionPermissionSet> {
285 public: 288 public:
286 // Creates an empty permission set (e.g. default permissions). 289 // Creates an empty permission set (e.g. default permissions).
287 ExtensionPermissionSet(); 290 ExtensionPermissionSet();
288 291
289 // Creates a new permission set based on the |extension| manifest data, and 292 // Creates a new permission set based on the |extension| manifest data, and
290 // the api and host permissions (|apis| and |hosts|). The effective hosts 293 // the api and host permissions (|apis| and |hosts|). The effective hosts
291 // of the newly created permission set will be inferred from the |extension| 294 // of the newly created permission set will be inferred from the |extension|
292 // manifest, |apis| and |hosts|. 295 // manifest, |apis| and |hosts|.
293 ExtensionPermissionSet(const Extension* extension, 296 ExtensionPermissionSet(const extensions::Extension* extension,
294 const ExtensionAPIPermissionSet& apis, 297 const ExtensionAPIPermissionSet& apis,
295 const URLPatternSet& explicit_hosts, 298 const URLPatternSet& explicit_hosts,
296 const ExtensionOAuth2Scopes& scopes); 299 const ExtensionOAuth2Scopes& scopes);
297 300
298 301
299 // Creates a new permission set based on the specified data. 302 // Creates a new permission set based on the specified data.
300 ExtensionPermissionSet(const ExtensionAPIPermissionSet& apis, 303 ExtensionPermissionSet(const ExtensionAPIPermissionSet& apis,
301 const URLPatternSet& explicit_hosts, 304 const URLPatternSet& explicit_hosts,
302 const URLPatternSet& scriptable_hosts); 305 const URLPatternSet& scriptable_hosts);
303 306
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 friend class base::RefCountedThreadSafe<ExtensionPermissionSet>; 407 friend class base::RefCountedThreadSafe<ExtensionPermissionSet>;
405 408
406 ~ExtensionPermissionSet(); 409 ~ExtensionPermissionSet();
407 410
408 static std::set<std::string> GetDistinctHosts( 411 static std::set<std::string> GetDistinctHosts(
409 const URLPatternSet& host_patterns, 412 const URLPatternSet& host_patterns,
410 bool include_rcd, 413 bool include_rcd,
411 bool exclude_file_scheme); 414 bool exclude_file_scheme);
412 415
413 // Initializes the set based on |extension|'s manifest data. 416 // Initializes the set based on |extension|'s manifest data.
414 void InitImplicitExtensionPermissions(const Extension* extension); 417 void InitImplicitExtensionPermissions(const extensions::Extension* extension);
415 418
416 // Initializes the effective host permission based on the data in this set. 419 // Initializes the effective host permission based on the data in this set.
417 void InitEffectiveHosts(); 420 void InitEffectiveHosts();
418 421
419 // Gets the permission messages for the API permissions. 422 // Gets the permission messages for the API permissions.
420 std::set<ExtensionPermissionMessage> GetSimplePermissionMessages() const; 423 std::set<ExtensionPermissionMessage> GetSimplePermissionMessages() const;
421 424
422 // Returns true if |permissions| has an elevated API privilege level than 425 // Returns true if |permissions| has an elevated API privilege level than
423 // this set. 426 // this set.
424 bool HasLessAPIPrivilegesThan( 427 bool HasLessAPIPrivilegesThan(
(...skipping 21 matching lines...) Expand all
446 449
447 // The list of hosts this effectively grants access to. 450 // The list of hosts this effectively grants access to.
448 URLPatternSet effective_hosts_; 451 URLPatternSet effective_hosts_;
449 452
450 // A set of oauth2 scopes that are used by the identity API to create OAuth2 453 // A set of oauth2 scopes that are used by the identity API to create OAuth2
451 // tokens for accessing the Google Account of the signed-in sync account. 454 // tokens for accessing the Google Account of the signed-in sync account.
452 ExtensionOAuth2Scopes scopes_; 455 ExtensionOAuth2Scopes scopes_;
453 }; 456 };
454 457
455 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_ 458 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_PERMISSION_SET_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_messages.cc ('k') | chrome/common/extensions/extension_permission_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698