| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 // Sets the active |permissions|. | 534 // Sets the active |permissions|. |
| 535 void SetActivePermissions(const PermissionSet* permissions) const; | 535 void SetActivePermissions(const PermissionSet* permissions) const; |
| 536 | 536 |
| 537 // Gets the extension's active permission set. | 537 // Gets the extension's active permission set. |
| 538 scoped_refptr<const PermissionSet> GetActivePermissions() const; | 538 scoped_refptr<const PermissionSet> GetActivePermissions() const; |
| 539 | 539 |
| 540 // Whether context menu should be shown for page and browser actions. | 540 // Whether context menu should be shown for page and browser actions. |
| 541 bool ShowConfigureContextMenus() const; | 541 bool ShowConfigureContextMenus() const; |
| 542 | 542 |
| 543 // Returns the Homepage URL for this extension. If homepage_url was not | |
| 544 // specified in the manifest, this returns the Google Gallery URL. For | |
| 545 // third-party extensions, this returns a blank GURL. | |
| 546 GURL GetHomepageURL() const; | |
| 547 | |
| 548 // Returns a list of paths (relative to the extension dir) for images that | 543 // Returns a list of paths (relative to the extension dir) for images that |
| 549 // the browser might load (like themes and page action icons). | 544 // the browser might load (like themes and page action icons). |
| 550 std::set<FilePath> GetBrowserImages() const; | 545 std::set<FilePath> GetBrowserImages() const; |
| 551 | 546 |
| 552 // Get an extension icon as a resource or URL. | 547 // Get an extension icon as a resource or URL. |
| 553 ExtensionResource GetIconResource( | 548 ExtensionResource GetIconResource( |
| 554 int size, ExtensionIconSet::MatchType match_type) const; | 549 int size, ExtensionIconSet::MatchType match_type) const; |
| 555 GURL GetIconURL(int size, ExtensionIconSet::MatchType match_type) const; | 550 GURL GetIconURL(int size, ExtensionIconSet::MatchType match_type) const; |
| 556 | 551 |
| 557 // Gets the fully resolved absolute launch URL. | 552 // Gets the fully resolved absolute launch URL. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 706 } |
| 712 const std::vector<std::string>& background_scripts() const { | 707 const std::vector<std::string>& background_scripts() const { |
| 713 return background_scripts_; | 708 return background_scripts_; |
| 714 } | 709 } |
| 715 bool has_persistent_background_page() const { | 710 bool has_persistent_background_page() const { |
| 716 return has_background_page() && background_page_is_persistent_; | 711 return has_background_page() && background_page_is_persistent_; |
| 717 } | 712 } |
| 718 bool has_lazy_background_page() const { | 713 bool has_lazy_background_page() const { |
| 719 return has_background_page() && !background_page_is_persistent_; | 714 return has_background_page() && !background_page_is_persistent_; |
| 720 } | 715 } |
| 721 const GURL& options_url() const { return options_url_; } | |
| 722 const GURL& devtools_url() const { return devtools_url_; } | |
| 723 const GURL& details_url() const { return details_url_;} | 716 const GURL& details_url() const { return details_url_;} |
| 724 const PermissionSet* optional_permission_set() const { | 717 const PermissionSet* optional_permission_set() const { |
| 725 return optional_permission_set_.get(); | 718 return optional_permission_set_.get(); |
| 726 } | 719 } |
| 727 const PermissionSet* required_permission_set() const { | 720 const PermissionSet* required_permission_set() const { |
| 728 return required_permission_set_.get(); | 721 return required_permission_set_.get(); |
| 729 } | 722 } |
| 730 // Appends |new_warning[s]| to install_warnings_. | 723 // Appends |new_warning[s]| to install_warnings_. |
| 731 void AddInstallWarning(const InstallWarning& new_warning); | 724 void AddInstallWarning(const InstallWarning& new_warning); |
| 732 void AddInstallWarnings(const InstallWarningVector& new_warnings); | 725 void AddInstallWarnings(const InstallWarningVector& new_warnings); |
| 733 const InstallWarningVector& install_warnings() const { | 726 const InstallWarningVector& install_warnings() const { |
| 734 return install_warnings_; | 727 return install_warnings_; |
| 735 } | 728 } |
| 736 const GURL& update_url() const { return update_url_; } | |
| 737 const ExtensionIconSet& icons() const { return icons_; } | 729 const ExtensionIconSet& icons() const { return icons_; } |
| 738 const extensions::Manifest* manifest() const { | 730 const extensions::Manifest* manifest() const { |
| 739 return manifest_.get(); | 731 return manifest_.get(); |
| 740 } | 732 } |
| 741 const std::string default_locale() const { return default_locale_; } | 733 const std::string default_locale() const { return default_locale_; } |
| 742 const URLOverrideMap& GetChromeURLOverrides() const { | 734 const URLOverrideMap& GetChromeURLOverrides() const { |
| 743 return chrome_url_overrides_; | 735 return chrome_url_overrides_; |
| 744 } | 736 } |
| 745 bool incognito_split_mode() const { return incognito_split_mode_; } | 737 bool incognito_split_mode() const { return incognito_split_mode_; } |
| 746 bool offline_enabled() const { return offline_enabled_; } | 738 bool offline_enabled() const { return offline_enabled_; } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 const char* list_error, | 867 const char* list_error, |
| 876 const char* value_error, | 868 const char* value_error, |
| 877 string16* error); | 869 string16* error); |
| 878 bool LoadLaunchContainer(string16* error); | 870 bool LoadLaunchContainer(string16* error); |
| 879 bool LoadLaunchURL(string16* error); | 871 bool LoadLaunchURL(string16* error); |
| 880 | 872 |
| 881 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, | 873 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, |
| 882 string16* error); | 874 string16* error); |
| 883 bool LoadDescription(string16* error); | 875 bool LoadDescription(string16* error); |
| 884 bool LoadManifestVersion(string16* error); | 876 bool LoadManifestVersion(string16* error); |
| 885 bool LoadHomepageURL(string16* error); | |
| 886 bool LoadUpdateURL(string16* error); | |
| 887 bool LoadIcons(string16* error); | 877 bool LoadIcons(string16* error); |
| 888 bool LoadCommands(string16* error); | 878 bool LoadCommands(string16* error); |
| 889 bool LoadPlugins(string16* error); | 879 bool LoadPlugins(string16* error); |
| 890 bool LoadNaClModules(string16* error); | 880 bool LoadNaClModules(string16* error); |
| 891 bool LoadWebAccessibleResources(string16* error); | 881 bool LoadWebAccessibleResources(string16* error); |
| 892 bool LoadSandboxedPages(string16* error); | 882 bool LoadSandboxedPages(string16* error); |
| 893 // Must be called after LoadPlugins(). | 883 // Must be called after LoadPlugins(). |
| 894 bool LoadRequirements(string16* error); | 884 bool LoadRequirements(string16* error); |
| 895 bool LoadDefaultLocale(string16* error); | 885 bool LoadDefaultLocale(string16* error); |
| 896 bool LoadOfflineEnabled(string16* error); | 886 bool LoadOfflineEnabled(string16* error); |
| 897 bool LoadOptionsPage(string16* error); | |
| 898 bool LoadBackgroundScripts(string16* error); | 887 bool LoadBackgroundScripts(string16* error); |
| 899 bool LoadBackgroundScripts(const std::string& key, string16* error); | 888 bool LoadBackgroundScripts(const std::string& key, string16* error); |
| 900 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, | 889 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, |
| 901 string16* error); | 890 string16* error); |
| 902 bool LoadBackgroundPage(const std::string& key, | 891 bool LoadBackgroundPage(const std::string& key, |
| 903 const APIPermissionSet& api_permissions, | 892 const APIPermissionSet& api_permissions, |
| 904 string16* error); | 893 string16* error); |
| 905 bool LoadBackgroundPersistent( | 894 bool LoadBackgroundPersistent( |
| 906 const APIPermissionSet& api_permissions, | 895 const APIPermissionSet& api_permissions, |
| 907 string16* error); | 896 string16* error); |
| 908 bool LoadBackgroundAllowJSAccess( | 897 bool LoadBackgroundAllowJSAccess( |
| 909 const APIPermissionSet& api_permissions, | 898 const APIPermissionSet& api_permissions, |
| 910 string16* error); | 899 string16* error); |
| 911 // Parses a single action in the manifest. | 900 // Parses a single action in the manifest. |
| 912 bool LoadWebIntentAction(const std::string& action_name, | 901 bool LoadWebIntentAction(const std::string& action_name, |
| 913 const base::DictionaryValue& intent_service, | 902 const base::DictionaryValue& intent_service, |
| 914 string16* error); | 903 string16* error); |
| 915 bool LoadWebIntentServices(string16* error); | 904 bool LoadWebIntentServices(string16* error); |
| 916 bool LoadFileHandler(const std::string& handler_id, | 905 bool LoadFileHandler(const std::string& handler_id, |
| 917 const base::DictionaryValue& handler_info, | 906 const base::DictionaryValue& handler_info, |
| 918 string16* error); | 907 string16* error); |
| 919 bool LoadFileHandlers(string16* error); | 908 bool LoadFileHandlers(string16* error); |
| 920 bool LoadExtensionFeatures(APIPermissionSet* api_permissions, | 909 bool LoadExtensionFeatures(APIPermissionSet* api_permissions, |
| 921 string16* error); | 910 string16* error); |
| 922 bool LoadManifestHandlerFeatures(string16* error); | 911 bool LoadManifestHandlerFeatures(string16* error); |
| 923 bool LoadDevToolsPage(string16* error); | |
| 924 bool LoadInputComponents(const APIPermissionSet& api_permissions, | 912 bool LoadInputComponents(const APIPermissionSet& api_permissions, |
| 925 string16* error); | 913 string16* error); |
| 926 bool LoadContentScripts(string16* error); | 914 bool LoadContentScripts(string16* error); |
| 927 bool LoadPageAction(string16* error); | 915 bool LoadPageAction(string16* error); |
| 928 bool LoadBrowserAction(string16* error); | 916 bool LoadBrowserAction(string16* error); |
| 929 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); | 917 bool LoadSystemIndicator(APIPermissionSet* api_permissions, string16* error); |
| 930 bool LoadChromeURLOverrides(string16* error); | 918 bool LoadChromeURLOverrides(string16* error); |
| 931 bool LoadTextToSpeechVoices(string16* error); | 919 bool LoadTextToSpeechVoices(string16* error); |
| 932 bool LoadIncognitoMode(string16* error); | 920 bool LoadIncognitoMode(string16* error); |
| 933 bool LoadContentSecurityPolicy(string16* error); | 921 bool LoadContentSecurityPolicy(string16* error); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 // True if the background page should stay loaded forever; false if it should | 1097 // True if the background page should stay loaded forever; false if it should |
| 1110 // load on-demand (when it needs to handle an event). Defaults to true. | 1098 // load on-demand (when it needs to handle an event). Defaults to true. |
| 1111 bool background_page_is_persistent_; | 1099 bool background_page_is_persistent_; |
| 1112 | 1100 |
| 1113 // True if the background page can be scripted by pages of the app or | 1101 // True if the background page can be scripted by pages of the app or |
| 1114 // extension, in which case all such pages must run in the same process. | 1102 // extension, in which case all such pages must run in the same process. |
| 1115 // False if such pages are not permitted to script the background page, | 1103 // False if such pages are not permitted to script the background page, |
| 1116 // allowing them to run in different processes. | 1104 // allowing them to run in different processes. |
| 1117 bool allow_background_js_access_; | 1105 bool allow_background_js_access_; |
| 1118 | 1106 |
| 1119 // Optional URL to a page for setting options/preferences. | |
| 1120 GURL options_url_; | |
| 1121 | |
| 1122 // Optional URL to a devtools extension page. | |
| 1123 GURL devtools_url_; | |
| 1124 | |
| 1125 // URL to the webstore page of the extension. | 1107 // URL to the webstore page of the extension. |
| 1126 GURL details_url_; | 1108 GURL details_url_; |
| 1127 | 1109 |
| 1128 // The public key used to sign the contents of the crx package. | 1110 // The public key used to sign the contents of the crx package. |
| 1129 std::string public_key_; | 1111 std::string public_key_; |
| 1130 | 1112 |
| 1131 // A map of resource id's to relative file paths. | 1113 // A map of resource id's to relative file paths. |
| 1132 scoped_ptr<base::DictionaryValue> theme_images_; | 1114 scoped_ptr<base::DictionaryValue> theme_images_; |
| 1133 | 1115 |
| 1134 // A map of color names to colors. | 1116 // A map of color names to colors. |
| 1135 scoped_ptr<base::DictionaryValue> theme_colors_; | 1117 scoped_ptr<base::DictionaryValue> theme_colors_; |
| 1136 | 1118 |
| 1137 // A map of color names to colors. | 1119 // A map of color names to colors. |
| 1138 scoped_ptr<base::DictionaryValue> theme_tints_; | 1120 scoped_ptr<base::DictionaryValue> theme_tints_; |
| 1139 | 1121 |
| 1140 // A map of display properties. | 1122 // A map of display properties. |
| 1141 scoped_ptr<base::DictionaryValue> theme_display_properties_; | 1123 scoped_ptr<base::DictionaryValue> theme_display_properties_; |
| 1142 | 1124 |
| 1143 // The homepage for this extension. Useful if it is not hosted by Google and | |
| 1144 // therefore does not have a Gallery URL. | |
| 1145 GURL homepage_url_; | |
| 1146 | |
| 1147 // URL for fetching an update manifest | |
| 1148 GURL update_url_; | |
| 1149 | |
| 1150 // The manifest from which this extension was created. | 1125 // The manifest from which this extension was created. |
| 1151 scoped_ptr<Manifest> manifest_; | 1126 scoped_ptr<Manifest> manifest_; |
| 1152 | 1127 |
| 1153 // Stored parsed manifest data. | 1128 // Stored parsed manifest data. |
| 1154 ManifestDataMap manifest_data_; | 1129 ManifestDataMap manifest_data_; |
| 1155 | 1130 |
| 1156 // Set to true at the end of InitValue when initialization is finished. | 1131 // Set to true at the end of InitValue when initialization is finished. |
| 1157 bool finished_parsing_manifest_; | 1132 bool finished_parsing_manifest_; |
| 1158 | 1133 |
| 1159 // Ensures that any call to GetManifestData() prior to finishing | 1134 // Ensures that any call to GetManifestData() prior to finishing |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 | 1256 |
| 1282 UpdatedExtensionPermissionsInfo( | 1257 UpdatedExtensionPermissionsInfo( |
| 1283 const Extension* extension, | 1258 const Extension* extension, |
| 1284 const PermissionSet* permissions, | 1259 const PermissionSet* permissions, |
| 1285 Reason reason); | 1260 Reason reason); |
| 1286 }; | 1261 }; |
| 1287 | 1262 |
| 1288 } // namespace extensions | 1263 } // namespace extensions |
| 1289 | 1264 |
| 1290 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1265 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |