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 CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/hash_tables.h" | 17 #include "base/hash_tables.h" |
18 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
24 #include "chrome/common/extensions/extension_icon_set.h" | |
25 #include "chrome/common/extensions/manifest.h" | 24 #include "chrome/common/extensions/manifest.h" |
26 #include "chrome/common/extensions/permissions/api_permission.h" | 25 #include "chrome/common/extensions/permissions/api_permission.h" |
27 #include "chrome/common/extensions/permissions/permission_message.h" | 26 #include "chrome/common/extensions/permissions/permission_message.h" |
28 #include "chrome/common/extensions/user_script.h" | 27 #include "chrome/common/extensions/user_script.h" |
29 #include "extensions/common/extension_resource.h" | 28 #include "extensions/common/extension_resource.h" |
30 #include "extensions/common/install_warning.h" | 29 #include "extensions/common/install_warning.h" |
31 #include "extensions/common/url_pattern.h" | 30 #include "extensions/common/url_pattern.h" |
32 #include "extensions/common/url_pattern_set.h" | 31 #include "extensions/common/url_pattern_set.h" |
33 #include "googleurl/src/gurl.h" | 32 #include "googleurl/src/gurl.h" |
34 #include "ui/base/accelerators/accelerator.h" | 33 #include "ui/base/accelerators/accelerator.h" |
35 #include "ui/gfx/size.h" | 34 #include "ui/gfx/size.h" |
36 | 35 |
37 class ExtensionAction; | 36 class ExtensionAction; |
38 class SkBitmap; | 37 class SkBitmap; |
39 class Version; | 38 class Version; |
40 | 39 |
41 namespace base { | 40 namespace base { |
42 class DictionaryValue; | 41 class DictionaryValue; |
43 class ListValue; | 42 class ListValue; |
44 } | 43 } |
45 | 44 |
46 namespace gfx { | 45 namespace gfx { |
47 class ImageSkia; | 46 class ImageSkia; |
48 } | 47 } |
49 | 48 |
50 namespace extensions { | 49 namespace extensions { |
51 struct ActionInfo; | |
52 class APIPermissionSet; | 50 class APIPermissionSet; |
53 class PermissionSet; | 51 class PermissionSet; |
54 | 52 |
55 // Represents a Chrome extension. | 53 // Represents a Chrome extension. |
56 class Extension : public base::RefCountedThreadSafe<Extension> { | 54 class Extension : public base::RefCountedThreadSafe<Extension> { |
57 public: | 55 public: |
58 struct ManifestData; | 56 struct ManifestData; |
59 | 57 |
60 typedef std::vector<std::string> ScriptingWhitelist; | 58 typedef std::vector<std::string> ScriptingWhitelist; |
61 typedef std::map<const std::string, linked_ptr<ManifestData> > | 59 typedef std::map<const std::string, linked_ptr<ManifestData> > |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 const std::string& non_localized_name() const { return non_localized_name_; } | 420 const std::string& non_localized_name() const { return non_localized_name_; } |
423 // Base64-encoded version of the key used to sign this extension. | 421 // Base64-encoded version of the key used to sign this extension. |
424 // In pseudocode, returns | 422 // In pseudocode, returns |
425 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). | 423 // base::Base64Encode(RSAPrivateKey(pem_file).ExportPublicKey()). |
426 const std::string& public_key() const { return public_key_; } | 424 const std::string& public_key() const { return public_key_; } |
427 const std::string& description() const { return description_; } | 425 const std::string& description() const { return description_; } |
428 int manifest_version() const { return manifest_version_; } | 426 int manifest_version() const { return manifest_version_; } |
429 bool converted_from_user_script() const { | 427 bool converted_from_user_script() const { |
430 return converted_from_user_script_; | 428 return converted_from_user_script_; |
431 } | 429 } |
432 const ActionInfo* system_indicator_info() const { | |
433 return system_indicator_info_.get(); | |
434 } | |
435 const std::vector<NaClModuleInfo>& nacl_modules() const { | 430 const std::vector<NaClModuleInfo>& nacl_modules() const { |
436 return nacl_modules_; | 431 return nacl_modules_; |
437 } | 432 } |
438 const PermissionSet* optional_permission_set() const { | 433 const PermissionSet* optional_permission_set() const { |
439 return optional_permission_set_.get(); | 434 return optional_permission_set_.get(); |
440 } | 435 } |
441 const PermissionSet* required_permission_set() const { | 436 const PermissionSet* required_permission_set() const { |
442 return required_permission_set_.get(); | 437 return required_permission_set_.get(); |
443 } | 438 } |
444 // Returns the temporary APIPermissionSet used in initialization. | 439 // Returns the temporary APIPermissionSet used in initialization. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 566 |
572 bool LoadSharedFeatures(string16* error); | 567 bool LoadSharedFeatures(string16* error); |
573 bool LoadDescription(string16* error); | 568 bool LoadDescription(string16* error); |
574 bool LoadManifestVersion(string16* error); | 569 bool LoadManifestVersion(string16* error); |
575 bool LoadNaClModules(string16* error); | 570 bool LoadNaClModules(string16* error); |
576 bool LoadSandboxedPages(string16* error); | 571 bool LoadSandboxedPages(string16* error); |
577 // Must be called after the "plugins" key has been parsed. | 572 // Must be called after the "plugins" key has been parsed. |
578 bool LoadRequirements(string16* error); | 573 bool LoadRequirements(string16* error); |
579 bool LoadKioskEnabled(string16* error); | 574 bool LoadKioskEnabled(string16* error); |
580 bool LoadOfflineEnabled(string16* error); | 575 bool LoadOfflineEnabled(string16* error); |
581 bool LoadExtensionFeatures(string16* error); | |
582 bool LoadBrowserAction(string16* error); | |
583 bool LoadSystemIndicator(string16* error); | |
584 bool LoadTextToSpeechVoices(string16* error); | 576 bool LoadTextToSpeechVoices(string16* error); |
585 bool LoadIncognitoMode(string16* error); | |
586 bool LoadManagedModeFeatures(string16* error); | 577 bool LoadManagedModeFeatures(string16* error); |
587 bool LoadManagedModeSites( | 578 bool LoadManagedModeSites( |
588 const base::DictionaryValue* content_pack_value, | 579 const base::DictionaryValue* content_pack_value, |
589 string16* error); | 580 string16* error); |
590 bool LoadManagedModeConfigurations( | 581 bool LoadManagedModeConfigurations( |
591 const base::DictionaryValue* content_pack_value, | 582 const base::DictionaryValue* content_pack_value, |
592 string16* error); | 583 string16* error); |
593 | 584 |
594 // Returns true if the extension has more than one "UI surface". For example, | 585 // Returns true if the extension has more than one "UI surface". For example, |
595 // an extension that has a browser action and a page action. | 586 // an extension that has a browser action and a page action. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 // The extension's version. | 663 // The extension's version. |
673 scoped_ptr<Version> version_; | 664 scoped_ptr<Version> version_; |
674 | 665 |
675 // An optional longer description of the extension. | 666 // An optional longer description of the extension. |
676 std::string description_; | 667 std::string description_; |
677 | 668 |
678 // True if the extension was generated from a user script. (We show slightly | 669 // True if the extension was generated from a user script. (We show slightly |
679 // different UI if so). | 670 // different UI if so). |
680 bool converted_from_user_script_; | 671 bool converted_from_user_script_; |
681 | 672 |
682 // The extension's system indicator, if any. | |
683 scoped_ptr<ActionInfo> system_indicator_info_; | |
684 | |
685 // Optional list of NaCl modules and associated properties. | 673 // Optional list of NaCl modules and associated properties. |
686 std::vector<NaClModuleInfo> nacl_modules_; | 674 std::vector<NaClModuleInfo> nacl_modules_; |
687 | 675 |
688 // Optional list of extension pages that are sandboxed (served from a unique | 676 // Optional list of extension pages that are sandboxed (served from a unique |
689 // origin with a different Content Security Policy). | 677 // origin with a different Content Security Policy). |
690 URLPatternSet sandboxed_pages_; | 678 URLPatternSet sandboxed_pages_; |
691 | 679 |
692 // Content Security Policy that should be used to enforce the sandbox used | 680 // Content Security Policy that should be used to enforce the sandbox used |
693 // by sandboxed pages (guaranteed to have the "sandbox" directive without the | 681 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
694 // "allow-same-origin" token). | 682 // "allow-same-origin" token). |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 | 795 |
808 UpdatedExtensionPermissionsInfo( | 796 UpdatedExtensionPermissionsInfo( |
809 const Extension* extension, | 797 const Extension* extension, |
810 const PermissionSet* permissions, | 798 const PermissionSet* permissions, |
811 Reason reason); | 799 Reason reason); |
812 }; | 800 }; |
813 | 801 |
814 } // namespace extensions | 802 } // namespace extensions |
815 | 803 |
816 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 804 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |