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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 const GURL& url() const { return extension_url_; } | 188 const GURL& url() const { return extension_url_; } |
189 const Location location() const { return location_; } | 189 const Location location() const { return location_; } |
190 void set_location(Location location) { location_ = location; } | 190 void set_location(Location location) { location_ = location; } |
191 const std::string& id() const { return id_; } | 191 const std::string& id() const { return id_; } |
192 const Version* version() const { return version_.get(); } | 192 const Version* version() const { return version_.get(); } |
193 // String representation of the version number. | 193 // String representation of the version number. |
194 const std::string VersionString() const; | 194 const std::string VersionString() const; |
195 const std::string& name() const { return name_; } | 195 const std::string& name() const { return name_; } |
196 const std::string& public_key() const { return public_key_; } | 196 const std::string& public_key() const { return public_key_; } |
197 const std::string& description() const { return description_; } | 197 const std::string& description() const { return description_; } |
| 198 bool converted_from_user_script() const { |
| 199 return converted_from_user_script_; |
| 200 } |
198 const UserScriptList& content_scripts() const { return content_scripts_; } | 201 const UserScriptList& content_scripts() const { return content_scripts_; } |
199 ExtensionAction* page_action() const { return page_action_.get(); } | 202 ExtensionAction* page_action() const { return page_action_.get(); } |
200 ExtensionAction* browser_action() const { return browser_action_.get(); } | 203 ExtensionAction* browser_action() const { return browser_action_.get(); } |
201 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const { | 204 const std::vector<PrivacyBlacklistInfo>& privacy_blacklists() const { |
202 return privacy_blacklists_; | 205 return privacy_blacklists_; |
203 } | 206 } |
204 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 207 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
205 const GURL& background_url() const { return background_url_; } | 208 const GURL& background_url() const { return background_url_; } |
206 const GURL& options_url() const { return options_url_; } | 209 const GURL& options_url() const { return options_url_; } |
207 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } | 210 const std::vector<ToolstripInfo>& toolstrips() const { return toolstrips_; } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void SetBackgroundPageReady(); | 286 void SetBackgroundPageReady(); |
284 | 287 |
285 private: | 288 private: |
286 // Helper method that loads a UserScript object from a | 289 // Helper method that loads a UserScript object from a |
287 // dictionary in the content_script list of the manifest. | 290 // dictionary in the content_script list of the manifest. |
288 bool LoadUserScriptHelper(const DictionaryValue* content_script, | 291 bool LoadUserScriptHelper(const DictionaryValue* content_script, |
289 int definition_index, | 292 int definition_index, |
290 std::string* error, | 293 std::string* error, |
291 UserScript* result); | 294 UserScript* result); |
292 | 295 |
| 296 // Helper method that loads either the include_globs or exclude_globs list |
| 297 // from an entry in the content_script lists of the manifest. |
| 298 bool LoadGlobsHelper(const DictionaryValue* content_script, |
| 299 int content_script_index, |
| 300 const wchar_t* globs_property_name, |
| 301 std::string* error, |
| 302 void (UserScript::*add_method) (const std::string& glob), |
| 303 UserScript *instance); |
| 304 |
293 // Helper method to load an ExtensionAction from the page_action or | 305 // Helper method to load an ExtensionAction from the page_action or |
294 // browser_action entries in the manifest. | 306 // browser_action entries in the manifest. |
295 ExtensionAction* LoadExtensionActionHelper( | 307 ExtensionAction* LoadExtensionActionHelper( |
296 const DictionaryValue* extension_action, std::string* error); | 308 const DictionaryValue* extension_action, std::string* error); |
297 | 309 |
298 // Figures out if a source contains keys not associated with themes - we | 310 // Figures out if a source contains keys not associated with themes - we |
299 // don't want to allow scripts and such to be bundled with themes. | 311 // don't want to allow scripts and such to be bundled with themes. |
300 bool ContainsNonThemeKeys(const DictionaryValue& source); | 312 bool ContainsNonThemeKeys(const DictionaryValue& source); |
301 | 313 |
302 // The absolute path to the directory the extension is stored in. | 314 // The absolute path to the directory the extension is stored in. |
(...skipping 15 matching lines...) Expand all Loading... |
318 | 330 |
319 // The extension's version. | 331 // The extension's version. |
320 scoped_ptr<Version> version_; | 332 scoped_ptr<Version> version_; |
321 | 333 |
322 // The extension's human-readable name. | 334 // The extension's human-readable name. |
323 std::string name_; | 335 std::string name_; |
324 | 336 |
325 // An optional longer description of the extension. | 337 // An optional longer description of the extension. |
326 std::string description_; | 338 std::string description_; |
327 | 339 |
| 340 // True if the extension was generated from a user script. (We show slightly |
| 341 // different UI if so). |
| 342 bool converted_from_user_script_; |
| 343 |
328 // Paths to the content scripts the extension contains. | 344 // Paths to the content scripts the extension contains. |
329 UserScriptList content_scripts_; | 345 UserScriptList content_scripts_; |
330 | 346 |
331 // The extension's page action, if any. | 347 // The extension's page action, if any. |
332 scoped_ptr<ExtensionAction> page_action_; | 348 scoped_ptr<ExtensionAction> page_action_; |
333 | 349 |
334 // The extension's browser action, if any. | 350 // The extension's browser action, if any. |
335 scoped_ptr<ExtensionAction> browser_action_; | 351 scoped_ptr<ExtensionAction> browser_action_; |
336 | 352 |
337 // Optional list of privacy blacklistrom. | 353 // Optional list of privacy blacklistrom. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 411 |
396 // True if the background page is ready. | 412 // True if the background page is ready. |
397 bool background_page_ready_; | 413 bool background_page_ready_; |
398 | 414 |
399 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); | 415 FRIEND_TEST(ExtensionTest, LoadPageActionHelper); |
400 | 416 |
401 DISALLOW_COPY_AND_ASSIGN(Extension); | 417 DISALLOW_COPY_AND_ASSIGN(Extension); |
402 }; | 418 }; |
403 | 419 |
404 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 420 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
OLD | NEW |