| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class PermissionSet; | 55 class PermissionSet; |
| 56 | 56 |
| 57 typedef std::set<std::string> OAuth2Scopes; | 57 typedef std::set<std::string> OAuth2Scopes; |
| 58 | 58 |
| 59 // Represents a Chrome extension. | 59 // Represents a Chrome extension. |
| 60 class Extension : public base::RefCountedThreadSafe<Extension> { | 60 class Extension : public base::RefCountedThreadSafe<Extension> { |
| 61 public: | 61 public: |
| 62 struct InstallWarning; | 62 struct InstallWarning; |
| 63 struct ManifestData; | 63 struct ManifestData; |
| 64 | 64 |
| 65 typedef std::map<const std::string, GURL> URLOverrideMap; | |
| 66 typedef std::vector<std::string> ScriptingWhitelist; | 65 typedef std::vector<std::string> ScriptingWhitelist; |
| 67 typedef std::vector<InstallWarning> InstallWarningVector; | 66 typedef std::vector<InstallWarning> InstallWarningVector; |
| 68 typedef std::map<const std::string, linked_ptr<ManifestData> > | 67 typedef std::map<const std::string, linked_ptr<ManifestData> > |
| 69 ManifestDataMap; | 68 ManifestDataMap; |
| 70 | 69 |
| 71 // What an extension was loaded from. | 70 // What an extension was loaded from. |
| 72 // NOTE: These values are stored as integers in the preferences and used | 71 // NOTE: These values are stored as integers in the preferences and used |
| 73 // in histograms so don't remove or reorder existing items. Just append | 72 // in histograms so don't remove or reorder existing items. Just append |
| 74 // to the end. | 73 // to the end. |
| 75 enum Location { | 74 enum Location { |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 void AddInstallWarnings(const InstallWarningVector& new_warnings); | 708 void AddInstallWarnings(const InstallWarningVector& new_warnings); |
| 710 const InstallWarningVector& install_warnings() const { | 709 const InstallWarningVector& install_warnings() const { |
| 711 return install_warnings_; | 710 return install_warnings_; |
| 712 } | 711 } |
| 713 const GURL& update_url() const { return update_url_; } | 712 const GURL& update_url() const { return update_url_; } |
| 714 const ExtensionIconSet& icons() const { return icons_; } | 713 const ExtensionIconSet& icons() const { return icons_; } |
| 715 const extensions::Manifest* manifest() const { | 714 const extensions::Manifest* manifest() const { |
| 716 return manifest_.get(); | 715 return manifest_.get(); |
| 717 } | 716 } |
| 718 const std::string default_locale() const { return default_locale_; } | 717 const std::string default_locale() const { return default_locale_; } |
| 719 const URLOverrideMap& GetChromeURLOverrides() const { | |
| 720 return chrome_url_overrides_; | |
| 721 } | |
| 722 bool incognito_split_mode() const { return incognito_split_mode_; } | 718 bool incognito_split_mode() const { return incognito_split_mode_; } |
| 723 bool offline_enabled() const { return offline_enabled_; } | 719 bool offline_enabled() const { return offline_enabled_; } |
| 724 const OAuth2Info& oauth2_info() const { return oauth2_info_; } | 720 const OAuth2Info& oauth2_info() const { return oauth2_info_; } |
| 725 bool wants_file_access() const { return wants_file_access_; } | 721 bool wants_file_access() const { return wants_file_access_; } |
| 726 int creation_flags() const { return creation_flags_; } | 722 int creation_flags() const { return creation_flags_; } |
| 727 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 723 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
| 728 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 724 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
| 729 bool was_installed_by_default() const { | 725 bool was_installed_by_default() const { |
| 730 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; | 726 return (creation_flags_ & WAS_INSTALLED_BY_DEFAULT) != 0; |
| 731 } | 727 } |
| 732 | 728 |
| 733 // App-related. | 729 // App-related. |
| 734 bool is_app() const { | 730 bool is_app() const { |
| 735 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); | 731 return is_legacy_packaged_app() || is_hosted_app() || is_platform_app(); |
| 736 } | 732 } |
| 737 bool is_platform_app() const; | 733 bool is_platform_app() const; |
| 738 bool is_hosted_app() const; | 734 bool is_hosted_app() const; |
| 739 bool is_legacy_packaged_app() const; | 735 bool is_legacy_packaged_app() const; |
| 740 bool is_extension() const; | 736 bool is_extension() const; |
| 741 bool is_storage_isolated() const { return is_storage_isolated_; } | 737 bool is_storage_isolated() const { return is_storage_isolated_; } |
| 742 bool can_be_incognito_enabled() const; | 738 bool can_be_incognito_enabled() const; |
| 739 void AddWebExtentPattern(const URLPattern& pattern); |
| 743 const URLPatternSet& web_extent() const { return extent_; } | 740 const URLPatternSet& web_extent() const { return extent_; } |
| 744 const std::string& launch_local_path() const { return launch_local_path_; } | 741 const std::string& launch_local_path() const { return launch_local_path_; } |
| 745 const std::string& launch_web_url() const { return launch_web_url_; } | 742 const std::string& launch_web_url() const { return launch_web_url_; } |
| 746 extension_misc::LaunchContainer launch_container() const { | 743 extension_misc::LaunchContainer launch_container() const { |
| 747 return launch_container_; | 744 return launch_container_; |
| 748 } | 745 } |
| 749 int launch_width() const { return launch_width_; } | 746 int launch_width() const { return launch_width_; } |
| 750 int launch_height() const { return launch_height_; } | 747 int launch_height() const { return launch_height_; } |
| 751 | 748 |
| 752 const std::vector<FileHandlerInfo>& file_handlers() const { | 749 const std::vector<FileHandlerInfo>& file_handlers() const { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 string16* error); | 883 string16* error); |
| 887 bool LoadFileHandlers(string16* error); | 884 bool LoadFileHandlers(string16* error); |
| 888 bool LoadExtensionFeatures(APIPermissionSet* api_permissions, | 885 bool LoadExtensionFeatures(APIPermissionSet* api_permissions, |
| 889 string16* error); | 886 string16* error); |
| 890 bool LoadManifestHandlerFeatures(string16* error); | 887 bool LoadManifestHandlerFeatures(string16* error); |
| 891 bool LoadContentScripts(string16* error); | 888 bool LoadContentScripts(string16* error); |
| 892 bool LoadPageAction(string16* error); | 889 bool LoadPageAction(string16* error); |
| 893 bool LoadBrowserAction(string16* error); | 890 bool LoadBrowserAction(string16* error); |
| 894 bool LoadScriptBadge(string16* error); | 891 bool LoadScriptBadge(string16* error); |
| 895 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); | 892 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); |
| 896 bool LoadChromeURLOverrides(string16* error); | |
| 897 bool LoadTextToSpeechVoices(string16* error); | 893 bool LoadTextToSpeechVoices(string16* error); |
| 898 bool LoadIncognitoMode(string16* error); | 894 bool LoadIncognitoMode(string16* error); |
| 899 bool LoadContentSecurityPolicy(string16* error); | 895 bool LoadContentSecurityPolicy(string16* error); |
| 900 | 896 |
| 901 bool LoadThemeFeatures(string16* error); | 897 bool LoadThemeFeatures(string16* error); |
| 902 bool LoadThemeImages(const base::DictionaryValue* theme_value, | 898 bool LoadThemeImages(const base::DictionaryValue* theme_value, |
| 903 string16* error); | 899 string16* error); |
| 904 bool LoadThemeColors(const base::DictionaryValue* theme_value, | 900 bool LoadThemeColors(const base::DictionaryValue* theme_value, |
| 905 string16* error); | 901 string16* error); |
| 906 bool LoadThemeTints(const base::DictionaryValue* theme_value, | 902 bool LoadThemeTints(const base::DictionaryValue* theme_value, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1125 |
| 1130 // The manifest from which this extension was created. | 1126 // The manifest from which this extension was created. |
| 1131 scoped_ptr<Manifest> manifest_; | 1127 scoped_ptr<Manifest> manifest_; |
| 1132 | 1128 |
| 1133 // Stored parsed manifest data. | 1129 // Stored parsed manifest data. |
| 1134 ManifestDataMap manifest_data_; | 1130 ManifestDataMap manifest_data_; |
| 1135 | 1131 |
| 1136 // Set to true at the end of InitValue when initialization is finished. | 1132 // Set to true at the end of InitValue when initialization is finished. |
| 1137 bool finished_parsing_manifest_; | 1133 bool finished_parsing_manifest_; |
| 1138 | 1134 |
| 1139 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs | |
| 1140 // which override the handling of those URLs. (see ExtensionOverrideUI). | |
| 1141 URLOverrideMap chrome_url_overrides_; | |
| 1142 | |
| 1143 // Whether this extension requests isolated storage. | 1135 // Whether this extension requests isolated storage. |
| 1144 bool is_storage_isolated_; | 1136 bool is_storage_isolated_; |
| 1145 | 1137 |
| 1146 // The local path inside the extension to use with the launcher. | 1138 // The local path inside the extension to use with the launcher. |
| 1147 std::string launch_local_path_; | 1139 std::string launch_local_path_; |
| 1148 | 1140 |
| 1149 // A web url to use with the launcher. Note that this might be relative or | 1141 // A web url to use with the launcher. Note that this might be relative or |
| 1150 // absolute. If relative, it is relative to web_origin. | 1142 // absolute. If relative, it is relative to web_origin. |
| 1151 std::string launch_web_url_; | 1143 std::string launch_web_url_; |
| 1152 | 1144 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 | 1242 |
| 1251 UpdatedExtensionPermissionsInfo( | 1243 UpdatedExtensionPermissionsInfo( |
| 1252 const Extension* extension, | 1244 const Extension* extension, |
| 1253 const PermissionSet* permissions, | 1245 const PermissionSet* permissions, |
| 1254 Reason reason); | 1246 Reason reason); |
| 1255 }; | 1247 }; |
| 1256 | 1248 |
| 1257 } // namespace extensions | 1249 } // namespace extensions |
| 1258 | 1250 |
| 1259 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1251 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |