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

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

Powered by Google App Engine
This is Rietveld 408576698