OLD | NEW |
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_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> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 EXTERNAL_EXTENSION_UNINSTALLED, | 94 EXTERNAL_EXTENSION_UNINSTALLED, |
95 NUM_STATES | 95 NUM_STATES |
96 }; | 96 }; |
97 | 97 |
98 // Used to record the reason an extension was disabled. | 98 // Used to record the reason an extension was disabled. |
99 enum DisableReason { | 99 enum DisableReason { |
100 DISABLE_UNKNOWN, | 100 DISABLE_UNKNOWN, |
101 DISABLE_USER_ACTION, | 101 DISABLE_USER_ACTION, |
102 DISABLE_PERMISSIONS_INCREASE, | 102 DISABLE_PERMISSIONS_INCREASE, |
103 DISABLE_RELOAD, | 103 DISABLE_RELOAD, |
| 104 DISABLE_UNSUPPORTED_REQUIREMENT, |
104 DISABLE_LAST, // Not used. | 105 DISABLE_LAST, // Not used. |
105 }; | 106 }; |
106 | 107 |
107 enum InstallType { | 108 enum InstallType { |
108 INSTALL_ERROR, | 109 INSTALL_ERROR, |
109 DOWNGRADE, | 110 DOWNGRADE, |
110 REINSTALL, | 111 REINSTALL, |
111 UPGRADE, | 112 UPGRADE, |
112 NEW_INSTALL | 113 NEW_INSTALL |
113 }; | 114 }; |
114 | 115 |
115 // Do not change the order of entries or remove entries in this list | 116 // Do not change the order of entries or remove entries in this list |
116 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. | 117 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. |
117 enum Type { | 118 enum Type { |
118 TYPE_UNKNOWN = 0, | 119 TYPE_UNKNOWN = 0, |
119 TYPE_EXTENSION, | 120 TYPE_EXTENSION, |
120 TYPE_THEME, | 121 TYPE_THEME, |
121 TYPE_USER_SCRIPT, | 122 TYPE_USER_SCRIPT, |
122 TYPE_HOSTED_APP, | 123 TYPE_HOSTED_APP, |
123 TYPE_PACKAGED_APP, | 124 TYPE_PACKAGED_APP, |
124 TYPE_PLATFORM_APP | 125 TYPE_PLATFORM_APP |
125 }; | 126 }; |
126 | 127 |
127 enum SyncType { | 128 enum SyncType { |
128 SYNC_TYPE_NONE = 0, | 129 SYNC_TYPE_NONE = 0, |
129 SYNC_TYPE_EXTENSION, | 130 SYNC_TYPE_EXTENSION, |
130 SYNC_TYPE_APP | 131 SYNC_TYPE_APP |
131 }; | 132 }; |
132 | 133 |
| 134 // Declared requirements for the extension. |
| 135 struct Requirements { |
| 136 Requirements(); |
| 137 ~Requirements(); |
| 138 |
| 139 bool webgl; |
| 140 bool css3d; |
| 141 bool plugins; |
| 142 }; |
| 143 |
133 // An NPAPI plugin included in the extension. | 144 // An NPAPI plugin included in the extension. |
134 struct PluginInfo { | 145 struct PluginInfo { |
135 FilePath path; // Path to the plugin. | 146 FilePath path; // Path to the plugin. |
136 bool is_public; // False if only this extension can load this plugin. | 147 bool is_public; // False if only this extension can load this plugin. |
137 }; | 148 }; |
138 | 149 |
139 // An NaCl module included in the extension. | 150 // An NaCl module included in the extension. |
140 struct NaClModuleInfo { | 151 struct NaClModuleInfo { |
141 GURL url; | 152 GURL url; |
142 std::string mime_type; | 153 std::string mime_type; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // Updates the tab-specific permissions of |tab_id| to include those from | 583 // Updates the tab-specific permissions of |tab_id| to include those from |
573 // |permissions|. | 584 // |permissions|. |
574 void UpdateTabSpecificPermissions(int tab_id, | 585 void UpdateTabSpecificPermissions(int tab_id, |
575 const PermissionSet* permissions) const; | 586 const PermissionSet* permissions) const; |
576 | 587 |
577 // Clears the tab-specific permissions of |tab_id|. | 588 // Clears the tab-specific permissions of |tab_id|. |
578 void ClearTabSpecificPermissions(int tab_id) const; | 589 void ClearTabSpecificPermissions(int tab_id) const; |
579 | 590 |
580 // Accessors: | 591 // Accessors: |
581 | 592 |
| 593 const Requirements& requirements() const { return requirements_; } |
582 const FilePath& path() const { return path_; } | 594 const FilePath& path() const { return path_; } |
583 const GURL& url() const { return extension_url_; } | 595 const GURL& url() const { return extension_url_; } |
584 Location location() const; | 596 Location location() const; |
585 const std::string& id() const; | 597 const std::string& id() const; |
586 const Version* version() const { return version_.get(); } | 598 const Version* version() const { return version_.get(); } |
587 const std::string VersionString() const; | 599 const std::string VersionString() const; |
588 const std::string& name() const { return name_; } | 600 const std::string& name() const { return name_; } |
589 const std::string& non_localized_name() const { return non_localized_name_; } | 601 const std::string& non_localized_name() const { return non_localized_name_; } |
590 // Base64-encoded version of the key used to sign this extension. | 602 // Base64-encoded version of the key used to sign this extension. |
591 // In pseudocode, returns | 603 // In pseudocode, returns |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 bool LoadDescription(string16* error); | 805 bool LoadDescription(string16* error); |
794 bool LoadManifestVersion(string16* error); | 806 bool LoadManifestVersion(string16* error); |
795 bool LoadHomepageURL(string16* error); | 807 bool LoadHomepageURL(string16* error); |
796 bool LoadUpdateURL(string16* error); | 808 bool LoadUpdateURL(string16* error); |
797 bool LoadIcons(string16* error); | 809 bool LoadIcons(string16* error); |
798 bool LoadCommands(string16* error); | 810 bool LoadCommands(string16* error); |
799 bool LoadPlugins(string16* error); | 811 bool LoadPlugins(string16* error); |
800 bool LoadNaClModules(string16* error); | 812 bool LoadNaClModules(string16* error); |
801 bool LoadWebAccessibleResources(string16* error); | 813 bool LoadWebAccessibleResources(string16* error); |
802 bool LoadSandboxedPages(string16* error); | 814 bool LoadSandboxedPages(string16* error); |
803 bool CheckRequirements(string16* error); | 815 bool LoadRequirements(string16* error); |
804 bool LoadDefaultLocale(string16* error); | 816 bool LoadDefaultLocale(string16* error); |
805 bool LoadOfflineEnabled(string16* error); | 817 bool LoadOfflineEnabled(string16* error); |
806 bool LoadOptionsPage(string16* error); | 818 bool LoadOptionsPage(string16* error); |
807 bool LoadBackgroundScripts(string16* error); | 819 bool LoadBackgroundScripts(string16* error); |
808 bool LoadBackgroundScripts(const std::string& key, string16* error); | 820 bool LoadBackgroundScripts(const std::string& key, string16* error); |
809 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, | 821 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, |
810 string16* error); | 822 string16* error); |
811 bool LoadBackgroundPage(const std::string& key, | 823 bool LoadBackgroundPage(const std::string& key, |
812 const APIPermissionSet& api_permissions, | 824 const APIPermissionSet& api_permissions, |
813 string16* error); | 825 string16* error); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 std::string non_localized_name_; | 936 std::string non_localized_name_; |
925 | 937 |
926 // The version of this extension's manifest. We increase the manifest | 938 // The version of this extension's manifest. We increase the manifest |
927 // version when making breaking changes to the extension system. | 939 // version when making breaking changes to the extension system. |
928 // Version 1 was the first manifest version (implied by a lack of a | 940 // Version 1 was the first manifest version (implied by a lack of a |
929 // manifest_version attribute in the extension's manifest). We initialize | 941 // manifest_version attribute in the extension's manifest). We initialize |
930 // this member variable to 0 to distinguish the "uninitialized" case from | 942 // this member variable to 0 to distinguish the "uninitialized" case from |
931 // the case when we know the manifest version actually is 1. | 943 // the case when we know the manifest version actually is 1. |
932 int manifest_version_; | 944 int manifest_version_; |
933 | 945 |
| 946 // The requirements declared in the manifest. |
| 947 Requirements requirements_; |
| 948 |
934 // The absolute path to the directory the extension is stored in. | 949 // The absolute path to the directory the extension is stored in. |
935 FilePath path_; | 950 FilePath path_; |
936 | 951 |
937 // Default locale for fall back. Can be empty if extension is not localized. | 952 // Default locale for fall back. Can be empty if extension is not localized. |
938 std::string default_locale_; | 953 std::string default_locale_; |
939 | 954 |
940 // If true, a separate process will be used for the extension in incognito | 955 // If true, a separate process will be used for the extension in incognito |
941 // mode. | 956 // mode. |
942 bool incognito_split_mode_; | 957 bool incognito_split_mode_; |
943 | 958 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 // only the permissions that have added, and for Reason::REMOVED, this would | 1199 // only the permissions that have added, and for Reason::REMOVED, this would |
1185 // only contain the removed permissions. | 1200 // only contain the removed permissions. |
1186 const PermissionSet* permissions; | 1201 const PermissionSet* permissions; |
1187 | 1202 |
1188 UpdatedExtensionPermissionsInfo( | 1203 UpdatedExtensionPermissionsInfo( |
1189 const Extension* extension, | 1204 const Extension* extension, |
1190 const PermissionSet* permissions, | 1205 const PermissionSet* permissions, |
1191 Reason reason); | 1206 Reason reason); |
1192 }; | 1207 }; |
1193 | 1208 |
1194 } // namespace extensions | 1209 } // namespace extensions |
1195 | 1210 |
1196 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1211 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |