OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 EXTENSIONS_COMMON_EXTENSION_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_H_ |
6 #define EXTENSIONS_COMMON_EXTENSION_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
(...skipping 25 matching lines...) Expand all Loading... |
36 namespace base { | 36 namespace base { |
37 class DictionaryValue; | 37 class DictionaryValue; |
38 class Version; | 38 class Version; |
39 } | 39 } |
40 | 40 |
41 namespace gfx { | 41 namespace gfx { |
42 class ImageSkia; | 42 class ImageSkia; |
43 } | 43 } |
44 | 44 |
45 namespace extensions { | 45 namespace extensions { |
46 class PermissionsData; | |
47 class APIPermissionSet; | 46 class APIPermissionSet; |
48 class ManifestPermissionSet; | 47 class ManifestPermissionSet; |
49 class PermissionSet; | 48 class PermissionSet; |
| 49 class PermissionsData; |
| 50 class PermissionsParser; |
50 | 51 |
51 // Uniquely identifies an Extension, using 32 characters from the alphabet | 52 // Uniquely identifies an Extension, using 32 characters from the alphabet |
52 // 'a'-'p'. An empty string represents "no extension". | 53 // 'a'-'p'. An empty string represents "no extension". |
53 // | 54 // |
54 // Note: If this gets used heavily in files that don't otherwise need to include | 55 // Note: If this gets used heavily in files that don't otherwise need to include |
55 // extension.h, we should pull it into a dedicated header. | 56 // extension.h, we should pull it into a dedicated header. |
56 typedef std::string ExtensionId; | 57 typedef std::string ExtensionId; |
57 | 58 |
58 // Represents a Chrome extension. | 59 // Represents a Chrome extension. |
59 // Once created, an Extension object is immutable, with the exception of its | 60 // Once created, an Extension object is immutable, with the exception of its |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 const std::string& non_localized_name() const { return non_localized_name_; } | 303 const std::string& non_localized_name() const { return non_localized_name_; } |
303 // Base64-encoded version of the key used to sign this extension. | 304 // Base64-encoded version of the key used to sign this extension. |
304 // In pseudocode, returns | 305 // In pseudocode, returns |
305 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). | 306 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). |
306 const std::string& public_key() const { return public_key_; } | 307 const std::string& public_key() const { return public_key_; } |
307 const std::string& description() const { return description_; } | 308 const std::string& description() const { return description_; } |
308 int manifest_version() const { return manifest_version_; } | 309 int manifest_version() const { return manifest_version_; } |
309 bool converted_from_user_script() const { | 310 bool converted_from_user_script() const { |
310 return converted_from_user_script_; | 311 return converted_from_user_script_; |
311 } | 312 } |
312 PermissionsData* permissions_data() { return permissions_data_.get(); } | 313 PermissionsParser* permissions_parser() { return permissions_parser_.get(); } |
| 314 const PermissionsParser* permissions_parser() const { |
| 315 return permissions_parser_.get(); |
| 316 } |
| 317 |
313 const PermissionsData* permissions_data() const { | 318 const PermissionsData* permissions_data() const { |
314 return permissions_data_.get(); | 319 return permissions_data_.get(); |
315 } | 320 } |
316 | 321 |
317 // Appends |new_warning[s]| to install_warnings_. | 322 // Appends |new_warning[s]| to install_warnings_. |
318 void AddInstallWarning(const InstallWarning& new_warning); | 323 void AddInstallWarning(const InstallWarning& new_warning); |
319 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); | 324 void AddInstallWarnings(const std::vector<InstallWarning>& new_warnings); |
320 const std::vector<InstallWarning>& install_warnings() const { | 325 const std::vector<InstallWarning>& install_warnings() const { |
321 return install_warnings_; | 326 return install_warnings_; |
322 } | 327 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // this member variable to 0 to distinguish the "uninitialized" case from | 426 // this member variable to 0 to distinguish the "uninitialized" case from |
422 // the case when we know the manifest version actually is 1. | 427 // the case when we know the manifest version actually is 1. |
423 int manifest_version_; | 428 int manifest_version_; |
424 | 429 |
425 // The absolute path to the directory the extension is stored in. | 430 // The absolute path to the directory the extension is stored in. |
426 base::FilePath path_; | 431 base::FilePath path_; |
427 | 432 |
428 // Defines the set of URLs in the extension's web content. | 433 // Defines the set of URLs in the extension's web content. |
429 URLPatternSet extent_; | 434 URLPatternSet extent_; |
430 | 435 |
| 436 // The parser for the manifest's permissions. This is NULL anytime not during |
| 437 // initialization. |
| 438 // TODO(rdevlin.cronin): This doesn't really belong here. |
| 439 scoped_ptr<PermissionsParser> permissions_parser_; |
| 440 |
| 441 // The active permissions for the extension. |
431 scoped_ptr<PermissionsData> permissions_data_; | 442 scoped_ptr<PermissionsData> permissions_data_; |
432 | 443 |
433 // Any warnings that occurred when trying to create/parse the extension. | 444 // Any warnings that occurred when trying to create/parse the extension. |
434 std::vector<InstallWarning> install_warnings_; | 445 std::vector<InstallWarning> install_warnings_; |
435 | 446 |
436 // The base extension url for the extension. | 447 // The base extension url for the extension. |
437 GURL extension_url_; | 448 GURL extension_url_; |
438 | 449 |
439 // The extension's version. | 450 // The extension's version. |
440 scoped_ptr<base::Version> version_; | 451 scoped_ptr<base::Version> version_; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 572 |
562 UpdatedExtensionPermissionsInfo( | 573 UpdatedExtensionPermissionsInfo( |
563 const Extension* extension, | 574 const Extension* extension, |
564 const PermissionSet* permissions, | 575 const PermissionSet* permissions, |
565 Reason reason); | 576 Reason reason); |
566 }; | 577 }; |
567 | 578 |
568 } // namespace extensions | 579 } // namespace extensions |
569 | 580 |
570 #endif // EXTENSIONS_COMMON_EXTENSION_H_ | 581 #endif // EXTENSIONS_COMMON_EXTENSION_H_ |
OLD | NEW |