OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const Location location() const { return location_; } | 178 const Location location() const { return location_; } |
179 void set_location(Location location) { location_ = location; } | 179 void set_location(Location location) { location_ = location; } |
180 const std::string& id() const { return id_; } | 180 const std::string& id() const { return id_; } |
181 const Version* version() const { return version_.get(); } | 181 const Version* version() const { return version_.get(); } |
182 // String representation of the version number. | 182 // String representation of the version number. |
183 const std::string VersionString() const; | 183 const std::string VersionString() const; |
184 const std::string& name() const { return name_; } | 184 const std::string& name() const { return name_; } |
185 const std::string& public_key() const { return public_key_; } | 185 const std::string& public_key() const { return public_key_; } |
186 const std::string& description() const { return description_; } | 186 const std::string& description() const { return description_; } |
187 const UserScriptList& content_scripts() const { return content_scripts_; } | 187 const UserScriptList& content_scripts() const { return content_scripts_; } |
188 const ExtensionActionMap& page_actions() const { return page_actions_; } | 188 ExtensionAction* page_action() const { return page_action_.get(); } |
189 ExtensionAction* browser_action() const { return browser_action_.get(); } | 189 ExtensionAction* browser_action() const { return browser_action_.get(); } |
190 ExtensionActionState* browser_action_state() { | 190 ExtensionActionState* browser_action_state() { |
191 return browser_action_state_.get(); | 191 return browser_action_state_.get(); |
192 } | 192 } |
193 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const { | 193 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const { |
194 return privacy_blacklists_; | 194 return privacy_blacklists_; |
195 } | 195 } |
196 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 196 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
197 const GURL& background_url() const { return background_url_; } | 197 const GURL& background_url() const { return background_url_; } |
198 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } | 198 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } |
(...skipping 14 matching lines...) Expand all Loading... |
213 const std::set<std::string> GetEffectiveHostPermissions() const; | 213 const std::set<std::string> GetEffectiveHostPermissions() const; |
214 | 214 |
215 // Whether the extension has access to all hosts. This is true if there is | 215 // Whether the extension has access to all hosts. This is true if there is |
216 // a content script that matches all hosts, or if there is a host permission | 216 // a content script that matches all hosts, or if there is a host permission |
217 // for all hosts. | 217 // for all hosts. |
218 bool HasAccessToAllHosts() const; | 218 bool HasAccessToAllHosts() const; |
219 | 219 |
220 const GURL& update_url() const { return update_url_; } | 220 const GURL& update_url() const { return update_url_; } |
221 const std::map<int, std::string>& icons() { return icons_; } | 221 const std::map<int, std::string>& icons() { return icons_; } |
222 | 222 |
223 // Retrieves a page action or browser action by |id|. | |
224 const ExtensionAction* GetExtensionAction( | |
225 std::string id, ExtensionAction::ExtensionActionType action_type) const; | |
226 | |
227 // Returns the origin of this extension. This function takes a |registry_path| | 223 // Returns the origin of this extension. This function takes a |registry_path| |
228 // so that the registry location can be overwritten during testing. | 224 // so that the registry location can be overwritten during testing. |
229 Location ExternalExtensionInstallType(std::string registry_path); | 225 Location ExternalExtensionInstallType(std::string registry_path); |
230 | 226 |
231 // Theme-related. | 227 // Theme-related. |
232 DictionaryValue* GetThemeImages() const { return theme_images_.get(); } | 228 DictionaryValue* GetThemeImages() const { return theme_images_.get(); } |
233 DictionaryValue* GetThemeColors() const { return theme_colors_.get(); } | 229 DictionaryValue* GetThemeColors() const { return theme_colors_.get(); } |
234 DictionaryValue* GetThemeTints() const { return theme_tints_.get(); } | 230 DictionaryValue* GetThemeTints() const { return theme_tints_.get(); } |
235 DictionaryValue* GetThemeDisplayProperties() const { | 231 DictionaryValue* GetThemeDisplayProperties() const { |
236 return theme_display_properties_.get(); | 232 return theme_display_properties_.get(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // dictionary in the content_script list of the manifest. | 272 // dictionary in the content_script list of the manifest. |
277 bool LoadUserScriptHelper(const DictionaryValue* content_script, | 273 bool LoadUserScriptHelper(const DictionaryValue* content_script, |
278 int definition_index, | 274 int definition_index, |
279 std::string* error, | 275 std::string* error, |
280 UserScript* result); | 276 UserScript* result); |
281 | 277 |
282 // Helper method that loads a ExtensionAction object from a | 278 // Helper method that loads a ExtensionAction object from a |
283 // dictionary in the page_action or browser_action section of the manifest. | 279 // dictionary in the page_action or browser_action section of the manifest. |
284 ExtensionAction* LoadExtensionActionHelper( | 280 ExtensionAction* LoadExtensionActionHelper( |
285 const DictionaryValue* contextual_action, | 281 const DictionaryValue* contextual_action, |
286 int definition_index, | |
287 std::string* error, | 282 std::string* error, |
288 ExtensionAction::ExtensionActionType action_type); | 283 ExtensionAction::ExtensionActionType action_type); |
289 | 284 |
290 // Figures out if a source contains keys not associated with themes - we | 285 // Figures out if a source contains keys not associated with themes - we |
291 // don't want to allow scripts and such to be bundled with themes. | 286 // don't want to allow scripts and such to be bundled with themes. |
292 bool ContainsNonThemeKeys(const DictionaryValue& source); | 287 bool ContainsNonThemeKeys(const DictionaryValue& source); |
293 | 288 |
294 // The absolute path to the directory the extension is stored in. | 289 // The absolute path to the directory the extension is stored in. |
295 FilePath path_; | 290 FilePath path_; |
296 | 291 |
(...skipping 16 matching lines...) Expand all Loading... |
313 | 308 |
314 // The extension's human-readable name. | 309 // The extension's human-readable name. |
315 std::string name_; | 310 std::string name_; |
316 | 311 |
317 // An optional longer description of the extension. | 312 // An optional longer description of the extension. |
318 std::string description_; | 313 std::string description_; |
319 | 314 |
320 // Paths to the content scripts the extension contains. | 315 // Paths to the content scripts the extension contains. |
321 UserScriptList content_scripts_; | 316 UserScriptList content_scripts_; |
322 | 317 |
323 // A list of page actions. | 318 // The extension's page action, if any. |
324 ExtensionActionMap page_actions_; | 319 scoped_ptr<ExtensionAction> page_action_; |
325 | 320 |
326 // The extension's browser action, if any. | 321 // The extension's browser action, if any. |
327 scoped_ptr<ExtensionAction> browser_action_; | 322 scoped_ptr<ExtensionAction> browser_action_; |
328 | 323 |
329 // The state of the browser action. Valid iff browser_action_ is non-NULL. | 324 // The state of the browser action. Valid iff browser_action_ is non-NULL. |
330 scoped_ptr<ExtensionActionState> browser_action_state_; | 325 scoped_ptr<ExtensionActionState> browser_action_state_; |
331 | 326 |
332 // Optional list of privacy blacklistrom. | 327 // Optional list of privacy blacklistrom. |
333 std::vector<PrivacyBlacklistInfo> privacy_blacklists_; | 328 std::vector<PrivacyBlacklistInfo> privacy_blacklists_; |
334 | 329 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 382 |
388 // True if the background page is ready. | 383 // True if the background page is ready. |
389 bool background_page_ready_; | 384 bool background_page_ready_; |
390 | 385 |
391 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); | 386 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); |
392 | 387 |
393 DISALLOW_COPY_AND_ASSIGN(Extension); | 388 DISALLOW_COPY_AND_ASSIGN(Extension); |
394 }; | 389 }; |
395 | 390 |
396 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 391 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |