| 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_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; | 378 scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const; |
| 379 | 379 |
| 380 // Returns the ExtensionInfo from the prefs for the given extension. If the | 380 // Returns the ExtensionInfo from the prefs for the given extension. If the |
| 381 // extension is not present, NULL is returned. | 381 // extension is not present, NULL is returned. |
| 382 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 382 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
| 383 const std::string& extension_id) const; | 383 const std::string& extension_id) const; |
| 384 | 384 |
| 385 // We've downloaded an updated .crx file for the extension, but are waiting | 385 // We've downloaded an updated .crx file for the extension, but are waiting |
| 386 // for idle time to install it. | 386 // for idle time to install it. |
| 387 void SetIdleInstallInfo(const Extension* extension, | 387 void SetIdleInstallInfo(const Extension* extension, |
| 388 Extension::State initial_state); | 388 Extension::State initial_state, |
| 389 const syncer::StringOrdinal& page_ordinal); |
| 389 | 390 |
| 390 // Removes any idle install information we have for the given |extension_id|. | 391 // Removes any idle install information we have for the given |extension_id|. |
| 391 // Returns true if there was info to remove; false otherwise. | 392 // Returns true if there was info to remove; false otherwise. |
| 392 bool RemoveIdleInstallInfo(const std::string& extension_id); | 393 bool RemoveIdleInstallInfo(const std::string& extension_id); |
| 393 | 394 |
| 394 // Update the prefs to finish the update for an extension. | 395 // Update the prefs to finish the update for an extension. |
| 395 bool FinishIdleInstallInfo(const std::string& extension_id); | 396 bool FinishIdleInstallInfo(const std::string& extension_id); |
| 396 | 397 |
| 397 // Returns the ExtensionInfo from the prefs for idle install information for | 398 // Returns the ExtensionInfo from the prefs for idle install information for |
| 398 // |extension_id|, if we have any. Otherwise returns NULL. | 399 // |extension_id|, if we have any. Otherwise returns NULL. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // Checks whether there is a state pref for the extension and if so, whether | 601 // Checks whether there is a state pref for the extension and if so, whether |
| 601 // it matches |check_state|. | 602 // it matches |check_state|. |
| 602 bool DoesExtensionHaveState(const std::string& id, | 603 bool DoesExtensionHaveState(const std::string& id, |
| 603 Extension::State check_state) const; | 604 Extension::State check_state) const; |
| 604 | 605 |
| 605 // Helper function to Get/Set array of strings from/to prefs. | 606 // Helper function to Get/Set array of strings from/to prefs. |
| 606 ExtensionIdList GetExtensionPrefAsVector(const char* pref); | 607 ExtensionIdList GetExtensionPrefAsVector(const char* pref); |
| 607 void SetExtensionPrefFromVector(const char* pref, | 608 void SetExtensionPrefFromVector(const char* pref, |
| 608 const ExtensionIdList& extension_ids); | 609 const ExtensionIdList& extension_ids); |
| 609 | 610 |
| 611 // Helper function to populate |extension_dict| with the values needed |
| 612 // by a newly installed extension. Work is broken up between this |
| 613 // function and FinishExtensionInfoPrefs() to accomodate delayed |
| 614 // installations. |
| 615 void PopulateExtensionInfoPrefs(const Extension* extension, |
| 616 const base::Time install_time, |
| 617 Extension::State initial_state, |
| 618 DictionaryValue* extension_dict); |
| 619 |
| 620 // Helper function to complete initialization of the values in |
| 621 // |extension_dict| for an extension install. Also see |
| 622 // PopulateExtensionInfoPrefs(). |
| 623 void FinishExtensionInfoPrefs( |
| 624 const std::string& extension_id, |
| 625 const base::Time install_time, |
| 626 bool needs_sort_ordinal, |
| 627 const syncer::StringOrdinal& suggested_page_ordinal, |
| 628 DictionaryValue* extension_dict); |
| 629 |
| 610 // The pref service specific to this set of extension prefs. Owned by profile. | 630 // The pref service specific to this set of extension prefs. Owned by profile. |
| 611 PrefService* prefs_; | 631 PrefService* prefs_; |
| 612 | 632 |
| 613 // Base extensions install directory. | 633 // Base extensions install directory. |
| 614 FilePath install_directory_; | 634 FilePath install_directory_; |
| 615 | 635 |
| 616 // Weak pointer, owned by Profile. | 636 // Weak pointer, owned by Profile. |
| 617 ExtensionPrefValueMap* extension_pref_value_map_; | 637 ExtensionPrefValueMap* extension_pref_value_map_; |
| 618 | 638 |
| 619 // Contains all the logic for handling the order for various extension | 639 // Contains all the logic for handling the order for various extension |
| 620 // properties. | 640 // properties. |
| 621 scoped_ptr<ExtensionSorting> extension_sorting_; | 641 scoped_ptr<ExtensionSorting> extension_sorting_; |
| 622 | 642 |
| 623 scoped_refptr<ContentSettingsStore> content_settings_store_; | 643 scoped_refptr<ContentSettingsStore> content_settings_store_; |
| 624 | 644 |
| 625 scoped_ptr<TimeProvider> time_provider_; | 645 scoped_ptr<TimeProvider> time_provider_; |
| 626 | 646 |
| 627 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 647 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 628 }; | 648 }; |
| 629 | 649 |
| 630 } // namespace extensions | 650 } // namespace extensions |
| 631 | 651 |
| 632 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 652 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| OLD | NEW |