| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 struct WebIntentServiceData; | 51 struct WebIntentServiceData; |
| 52 } | 52 } |
| 53 | 53 |
| 54 FORWARD_DECLARE_TEST(TabStripModelTest, Apps); | 54 FORWARD_DECLARE_TEST(TabStripModelTest, Apps); |
| 55 | 55 |
| 56 namespace extensions { | 56 namespace extensions { |
| 57 | 57 |
| 58 class Manifest; | 58 class Manifest; |
| 59 class PermissionSet; | 59 class PermissionSet; |
| 60 | 60 |
| 61 typedef std::set<std::string> OAuth2Scopes; | |
| 62 | |
| 63 // Represents a Chrome extension. | 61 // Represents a Chrome extension. |
| 64 class Extension : public base::RefCountedThreadSafe<Extension> { | 62 class Extension : public base::RefCountedThreadSafe<Extension> { |
| 65 public: | 63 public: |
| 66 struct InstallWarning; | 64 struct InstallWarning; |
| 67 struct ManifestData; | 65 struct ManifestData; |
| 68 | 66 |
| 69 typedef std::map<const std::string, GURL> URLOverrideMap; | 67 typedef std::map<const std::string, GURL> URLOverrideMap; |
| 70 typedef std::vector<std::string> ScriptingWhitelist; | 68 typedef std::vector<std::string> ScriptingWhitelist; |
| 71 typedef std::vector<InstallWarning> InstallWarningVector; | 69 typedef std::vector<InstallWarning> InstallWarningVector; |
| 72 typedef std::map<const std::string, linked_ptr<ManifestData> > | 70 typedef std::map<const std::string, linked_ptr<ManifestData> > |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 FilePath path; // Path to the plugin. | 166 FilePath path; // Path to the plugin. |
| 169 bool is_public; // False if only this extension can load this plugin. | 167 bool is_public; // False if only this extension can load this plugin. |
| 170 }; | 168 }; |
| 171 | 169 |
| 172 // An NaCl module included in the extension. | 170 // An NaCl module included in the extension. |
| 173 struct NaClModuleInfo { | 171 struct NaClModuleInfo { |
| 174 GURL url; | 172 GURL url; |
| 175 std::string mime_type; | 173 std::string mime_type; |
| 176 }; | 174 }; |
| 177 | 175 |
| 178 // OAuth2 info included in the extension. | |
| 179 struct OAuth2Info { | |
| 180 OAuth2Info(); | |
| 181 ~OAuth2Info(); | |
| 182 | |
| 183 OAuth2Scopes GetScopesAsSet(); | |
| 184 | |
| 185 std::string client_id; | |
| 186 std::vector<std::string> scopes; | |
| 187 }; | |
| 188 | |
| 189 struct ActionInfo { | 176 struct ActionInfo { |
| 190 explicit ActionInfo(); | 177 explicit ActionInfo(); |
| 191 ~ActionInfo(); | 178 ~ActionInfo(); |
| 192 | 179 |
| 193 // The types of extension actions. | 180 // The types of extension actions. |
| 194 enum Type { | 181 enum Type { |
| 195 TYPE_BROWSER, | 182 TYPE_BROWSER, |
| 196 TYPE_PAGE, | 183 TYPE_PAGE, |
| 197 TYPE_SCRIPT_BADGE, | 184 TYPE_SCRIPT_BADGE, |
| 198 TYPE_SYSTEM_INDICATOR, | 185 TYPE_SYSTEM_INDICATOR, |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 const ExtensionIconSet& icons() const { return icons_; } | 711 const ExtensionIconSet& icons() const { return icons_; } |
| 725 const extensions::Manifest* manifest() const { | 712 const extensions::Manifest* manifest() const { |
| 726 return manifest_.get(); | 713 return manifest_.get(); |
| 727 } | 714 } |
| 728 const std::string default_locale() const { return default_locale_; } | 715 const std::string default_locale() const { return default_locale_; } |
| 729 const URLOverrideMap& GetChromeURLOverrides() const { | 716 const URLOverrideMap& GetChromeURLOverrides() const { |
| 730 return chrome_url_overrides_; | 717 return chrome_url_overrides_; |
| 731 } | 718 } |
| 732 bool incognito_split_mode() const { return incognito_split_mode_; } | 719 bool incognito_split_mode() const { return incognito_split_mode_; } |
| 733 bool offline_enabled() const { return offline_enabled_; } | 720 bool offline_enabled() const { return offline_enabled_; } |
| 734 const OAuth2Info& oauth2_info() const { return oauth2_info_; } | |
| 735 const std::vector<webkit_glue::WebIntentServiceData>& | 721 const std::vector<webkit_glue::WebIntentServiceData>& |
| 736 intents_services() const { | 722 intents_services() const { |
| 737 return intents_services_; | 723 return intents_services_; |
| 738 } | 724 } |
| 739 | 725 |
| 740 bool wants_file_access() const { return wants_file_access_; } | 726 bool wants_file_access() const { return wants_file_access_; } |
| 741 int creation_flags() const { return creation_flags_; } | 727 int creation_flags() const { return creation_flags_; } |
| 742 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 728 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
| 743 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 729 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
| 744 bool was_installed_by_default() const { | 730 bool was_installed_by_default() const { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 void(UserScript::*add_method)(const std::string& glob), | 946 void(UserScript::*add_method)(const std::string& glob), |
| 961 UserScript* instance); | 947 UserScript* instance); |
| 962 | 948 |
| 963 // Helper method to load an ExtensionAction from the page_action or | 949 // Helper method to load an ExtensionAction from the page_action or |
| 964 // browser_action entries in the manifest. | 950 // browser_action entries in the manifest. |
| 965 scoped_ptr<ActionInfo> LoadExtensionActionInfoHelper( | 951 scoped_ptr<ActionInfo> LoadExtensionActionInfoHelper( |
| 966 const base::DictionaryValue* manifest_section, | 952 const base::DictionaryValue* manifest_section, |
| 967 ActionInfo::Type action_type, | 953 ActionInfo::Type action_type, |
| 968 string16* error); | 954 string16* error); |
| 969 | 955 |
| 970 // Helper method that loads the OAuth2 info from the 'oauth2' manifest key. | |
| 971 bool LoadOAuth2Info(string16* error); | |
| 972 | |
| 973 // Returns true if the extension has more than one "UI surface". For example, | 956 // Returns true if the extension has more than one "UI surface". For example, |
| 974 // an extension that has a browser action and a page action. | 957 // an extension that has a browser action and a page action. |
| 975 bool HasMultipleUISurfaces() const; | 958 bool HasMultipleUISurfaces() const; |
| 976 | 959 |
| 977 // Updates the launch URL and extents for the extension using the given | 960 // Updates the launch URL and extents for the extension using the given |
| 978 // |override_url|. | 961 // |override_url|. |
| 979 void OverrideLaunchUrl(const GURL& override_url); | 962 void OverrideLaunchUrl(const GURL& override_url); |
| 980 | 963 |
| 981 // Custom checks for the experimental permission that can't be expressed in | 964 // Custom checks for the experimental permission that can't be expressed in |
| 982 // _permission_features.json. | 965 // _permission_features.json. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 // containers like panels and windows. | 1173 // containers like panels and windows. |
| 1191 int launch_width_; | 1174 int launch_width_; |
| 1192 int launch_height_; | 1175 int launch_height_; |
| 1193 | 1176 |
| 1194 // Should this app be shown in the app launcher. | 1177 // Should this app be shown in the app launcher. |
| 1195 bool display_in_launcher_; | 1178 bool display_in_launcher_; |
| 1196 | 1179 |
| 1197 // Should this app be shown in the browser New Tab Page. | 1180 // Should this app be shown in the browser New Tab Page. |
| 1198 bool display_in_new_tab_page_; | 1181 bool display_in_new_tab_page_; |
| 1199 | 1182 |
| 1200 // The OAuth2 client id and scopes, if specified by the extension. | |
| 1201 OAuth2Info oauth2_info_; | |
| 1202 | |
| 1203 // List of intent services that this extension provides, if any. | 1183 // List of intent services that this extension provides, if any. |
| 1204 std::vector<webkit_glue::WebIntentServiceData> intents_services_; | 1184 std::vector<webkit_glue::WebIntentServiceData> intents_services_; |
| 1205 | 1185 |
| 1206 // List of file handlers associated with this extension, if any. | 1186 // List of file handlers associated with this extension, if any. |
| 1207 std::vector<FileHandlerInfo> file_handlers_; | 1187 std::vector<FileHandlerInfo> file_handlers_; |
| 1208 | 1188 |
| 1209 // Whether the extension has host permissions or user script patterns that | 1189 // Whether the extension has host permissions or user script patterns that |
| 1210 // imply access to file:/// scheme URLs (the user may not have actually | 1190 // imply access to file:/// scheme URLs (the user may not have actually |
| 1211 // granted it that access). | 1191 // granted it that access). |
| 1212 bool wants_file_access_; | 1192 bool wants_file_access_; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 | 1262 |
| 1283 UpdatedExtensionPermissionsInfo( | 1263 UpdatedExtensionPermissionsInfo( |
| 1284 const Extension* extension, | 1264 const Extension* extension, |
| 1285 const PermissionSet* permissions, | 1265 const PermissionSet* permissions, |
| 1286 Reason reason); | 1266 Reason reason); |
| 1287 }; | 1267 }; |
| 1288 | 1268 |
| 1289 } // namespace extensions | 1269 } // namespace extensions |
| 1290 | 1270 |
| 1291 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1271 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |