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

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

Issue 10689097: Enforce the 'requirements' field in manifests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changed plugins requirement schema Created 8 years, 4 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_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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DEPRECATED_DISABLE_PERMISSIONS_INCREASE, 105 DEPRECATED_DISABLE_PERMISSIONS_INCREASE,
106 DEPRECATED_DISABLE_RELOAD, 106 DEPRECATED_DISABLE_RELOAD,
107 DEPRECATED_DISABLE_LAST, // Not used. 107 DEPRECATED_DISABLE_LAST, // Not used.
108 }; 108 };
109 109
110 enum DisableReason { 110 enum DisableReason {
111 DISABLE_NONE = 0, 111 DISABLE_NONE = 0,
112 DISABLE_USER_ACTION = 1 << 0, 112 DISABLE_USER_ACTION = 1 << 0,
113 DISABLE_PERMISSIONS_INCREASE = 1 << 1, 113 DISABLE_PERMISSIONS_INCREASE = 1 << 1,
114 DISABLE_RELOAD = 1 << 2, 114 DISABLE_RELOAD = 1 << 2,
115 DISABLE_UNSUPPORTED_REQUIREMENT = 1 << 3
115 }; 116 };
116 117
117 enum InstallType { 118 enum InstallType {
118 INSTALL_ERROR, 119 INSTALL_ERROR,
119 DOWNGRADE, 120 DOWNGRADE,
120 REINSTALL, 121 REINSTALL,
121 UPGRADE, 122 UPGRADE,
122 NEW_INSTALL 123 NEW_INSTALL
123 }; 124 };
124 125
125 // Do not change the order of entries or remove entries in this list 126 // Do not change the order of entries or remove entries in this list
126 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions. 127 // as this is used in UMA_HISTOGRAM_ENUMERATIONs about extensions.
127 enum Type { 128 enum Type {
128 TYPE_UNKNOWN = 0, 129 TYPE_UNKNOWN = 0,
129 TYPE_EXTENSION, 130 TYPE_EXTENSION,
130 TYPE_THEME, 131 TYPE_THEME,
131 TYPE_USER_SCRIPT, 132 TYPE_USER_SCRIPT,
132 TYPE_HOSTED_APP, 133 TYPE_HOSTED_APP,
133 TYPE_PACKAGED_APP, 134 TYPE_PACKAGED_APP,
134 TYPE_PLATFORM_APP 135 TYPE_PLATFORM_APP
135 }; 136 };
136 137
137 enum SyncType { 138 enum SyncType {
138 SYNC_TYPE_NONE = 0, 139 SYNC_TYPE_NONE = 0,
139 SYNC_TYPE_EXTENSION, 140 SYNC_TYPE_EXTENSION,
140 SYNC_TYPE_APP 141 SYNC_TYPE_APP
141 }; 142 };
142 143
144 // Declared requirements for the extension.
145 struct Requirements {
146 Requirements();
147 ~Requirements();
148
149 bool webgl;
150 bool css3d;
151 bool npapi;
152 };
153
143 // An NPAPI plugin included in the extension. 154 // An NPAPI plugin included in the extension.
144 struct PluginInfo { 155 struct PluginInfo {
145 FilePath path; // Path to the plugin. 156 FilePath path; // Path to the plugin.
146 bool is_public; // False if only this extension can load this plugin. 157 bool is_public; // False if only this extension can load this plugin.
147 }; 158 };
148 159
149 // An NaCl module included in the extension. 160 // An NaCl module included in the extension.
150 struct NaClModuleInfo { 161 struct NaClModuleInfo {
151 GURL url; 162 GURL url;
152 std::string mime_type; 163 std::string mime_type;
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // |permissions|. 591 // |permissions|.
581 void UpdateTabSpecificPermissions( 592 void UpdateTabSpecificPermissions(
582 int tab_id, 593 int tab_id,
583 scoped_refptr<const PermissionSet> permissions) const; 594 scoped_refptr<const PermissionSet> permissions) const;
584 595
585 // Clears the tab-specific permissions of |tab_id|. 596 // Clears the tab-specific permissions of |tab_id|.
586 void ClearTabSpecificPermissions(int tab_id) const; 597 void ClearTabSpecificPermissions(int tab_id) const;
587 598
588 // Accessors: 599 // Accessors:
589 600
601 const Requirements& requirements() const { return requirements_; }
590 const FilePath& path() const { return path_; } 602 const FilePath& path() const { return path_; }
591 const GURL& url() const { return extension_url_; } 603 const GURL& url() const { return extension_url_; }
592 Location location() const; 604 Location location() const;
593 const std::string& id() const; 605 const std::string& id() const;
594 const Version* version() const { return version_.get(); } 606 const Version* version() const { return version_.get(); }
595 const std::string VersionString() const; 607 const std::string VersionString() const;
596 const std::string& name() const { return name_; } 608 const std::string& name() const { return name_; }
597 const std::string& non_localized_name() const { return non_localized_name_; } 609 const std::string& non_localized_name() const { return non_localized_name_; }
598 // Base64-encoded version of the key used to sign this extension. 610 // Base64-encoded version of the key used to sign this extension.
599 // In pseudocode, returns 611 // In pseudocode, returns
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 bool LoadDescription(string16* error); 820 bool LoadDescription(string16* error);
809 bool LoadManifestVersion(string16* error); 821 bool LoadManifestVersion(string16* error);
810 bool LoadHomepageURL(string16* error); 822 bool LoadHomepageURL(string16* error);
811 bool LoadUpdateURL(string16* error); 823 bool LoadUpdateURL(string16* error);
812 bool LoadIcons(string16* error); 824 bool LoadIcons(string16* error);
813 bool LoadCommands(string16* error); 825 bool LoadCommands(string16* error);
814 bool LoadPlugins(string16* error); 826 bool LoadPlugins(string16* error);
815 bool LoadNaClModules(string16* error); 827 bool LoadNaClModules(string16* error);
816 bool LoadWebAccessibleResources(string16* error); 828 bool LoadWebAccessibleResources(string16* error);
817 bool LoadSandboxedPages(string16* error); 829 bool LoadSandboxedPages(string16* error);
818 bool CheckRequirements(string16* error); 830 // Must be called after LoadPlugins().
831 bool LoadRequirements(string16* error);
819 bool LoadDefaultLocale(string16* error); 832 bool LoadDefaultLocale(string16* error);
820 bool LoadOfflineEnabled(string16* error); 833 bool LoadOfflineEnabled(string16* error);
821 bool LoadOptionsPage(string16* error); 834 bool LoadOptionsPage(string16* error);
822 bool LoadBackgroundScripts(string16* error); 835 bool LoadBackgroundScripts(string16* error);
823 bool LoadBackgroundScripts(const std::string& key, string16* error); 836 bool LoadBackgroundScripts(const std::string& key, string16* error);
824 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, 837 bool LoadBackgroundPage(const APIPermissionSet& api_permissions,
825 string16* error); 838 string16* error);
826 bool LoadBackgroundPage(const std::string& key, 839 bool LoadBackgroundPage(const std::string& key,
827 const APIPermissionSet& api_permissions, 840 const APIPermissionSet& api_permissions,
828 string16* error); 841 string16* error);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 std::string non_localized_name_; 952 std::string non_localized_name_;
940 953
941 // The version of this extension's manifest. We increase the manifest 954 // The version of this extension's manifest. We increase the manifest
942 // version when making breaking changes to the extension system. 955 // version when making breaking changes to the extension system.
943 // Version 1 was the first manifest version (implied by a lack of a 956 // Version 1 was the first manifest version (implied by a lack of a
944 // manifest_version attribute in the extension's manifest). We initialize 957 // manifest_version attribute in the extension's manifest). We initialize
945 // this member variable to 0 to distinguish the "uninitialized" case from 958 // this member variable to 0 to distinguish the "uninitialized" case from
946 // the case when we know the manifest version actually is 1. 959 // the case when we know the manifest version actually is 1.
947 int manifest_version_; 960 int manifest_version_;
948 961
962 // The requirements declared in the manifest.
963 Requirements requirements_;
964
949 // The absolute path to the directory the extension is stored in. 965 // The absolute path to the directory the extension is stored in.
950 FilePath path_; 966 FilePath path_;
951 967
952 // Default locale for fall back. Can be empty if extension is not localized. 968 // Default locale for fall back. Can be empty if extension is not localized.
953 std::string default_locale_; 969 std::string default_locale_;
954 970
955 // If true, a separate process will be used for the extension in incognito 971 // If true, a separate process will be used for the extension in incognito
956 // mode. 972 // mode.
957 bool incognito_split_mode_; 973 bool incognito_split_mode_;
958 974
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 // only the permissions that have added, and for Reason::REMOVED, this would 1208 // only the permissions that have added, and for Reason::REMOVED, this would
1193 // only contain the removed permissions. 1209 // only contain the removed permissions.
1194 const PermissionSet* permissions; 1210 const PermissionSet* permissions;
1195 1211
1196 UpdatedExtensionPermissionsInfo( 1212 UpdatedExtensionPermissionsInfo(
1197 const Extension* extension, 1213 const Extension* extension,
1198 const PermissionSet* permissions, 1214 const PermissionSet* permissions,
1199 Reason reason); 1215 Reason reason);
1200 }; 1216 };
1201 1217
1202 } // namespace extensions 1218 } // namespace extensions
1203 1219
1204 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1220 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698