Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // the extension, this will return false. Generally you should use | 171 // the extension, this will return false. Generally you should use |
| 172 // ExtensionService::IsExtensionEnabled instead. | 172 // ExtensionService::IsExtensionEnabled instead. |
| 173 bool IsExtensionDisabled(const std::string& id) const; | 173 bool IsExtensionDisabled(const std::string& id) const; |
| 174 | 174 |
| 175 // Get/Set the order that the browser actions appear in the toolbar. | 175 // Get/Set the order that the browser actions appear in the toolbar. |
| 176 ExtensionIdList GetToolbarOrder(); | 176 ExtensionIdList GetToolbarOrder(); |
| 177 void SetToolbarOrder(const ExtensionIdList& extension_ids); | 177 void SetToolbarOrder(const ExtensionIdList& extension_ids); |
| 178 | 178 |
| 179 // Called when an extension is installed, so that prefs get created. | 179 // Called when an extension is installed, so that prefs get created. |
| 180 // If |page_ordinal| is invalid then a page will be found for the App. | 180 // If |page_ordinal| is invalid then a page will be found for the App. |
| 181 // |initial_disable_reason| is the disable reason if |initial_state| is set | |
| 182 // to disable the extension initially, if applicable. | |
| 181 // |install_flags| are a bitmask of extension::InstallFlags. | 183 // |install_flags| are a bitmask of extension::InstallFlags. |
| 182 void OnExtensionInstalled(const Extension* extension, | 184 void OnExtensionInstalled(const Extension* extension, |
| 183 Extension::State initial_state, | 185 Extension::State initial_state, |
| 186 Extension::DisableReason initial_disable_reason, | |
| 184 const syncer::StringOrdinal& page_ordinal, | 187 const syncer::StringOrdinal& page_ordinal, |
| 185 int install_flags, | 188 int install_flags, |
| 186 const std::string& install_parameter); | 189 const std::string& install_parameter); |
| 187 // OnExtensionInstalled with no install flags. | 190 // OnExtensionInstalled with no install flags. |
| 188 void OnExtensionInstalled(const Extension* extension, | 191 void OnExtensionInstalled(const Extension* extension, |
| 189 Extension::State initial_state, | 192 Extension::State initial_state, |
| 193 Extension::DisableReason initial_disable_reason, | |
| 190 const syncer::StringOrdinal& page_ordinal, | 194 const syncer::StringOrdinal& page_ordinal, |
| 191 const std::string& install_parameter) { | 195 const std::string& install_parameter) { |
| 192 OnExtensionInstalled(extension, | 196 OnExtensionInstalled(extension, |
| 193 initial_state, | 197 initial_state, |
| 198 initial_disable_reason, | |
| 194 page_ordinal, | 199 page_ordinal, |
| 195 kInstallFlagNone, | 200 kInstallFlagNone, |
| 196 install_parameter); | 201 install_parameter); |
| 197 } | 202 } |
| 198 | 203 |
| 199 // Called when an extension is uninstalled, so that prefs get cleaned up. | 204 // Called when an extension is uninstalled, so that prefs get cleaned up. |
| 200 void OnExtensionUninstalled(const std::string& extension_id, | 205 void OnExtensionUninstalled(const std::string& extension_id, |
| 201 const Manifest::Location& location, | 206 const Manifest::Location& location, |
| 202 bool external_uninstall); | 207 bool external_uninstall); |
| 203 | 208 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 scoped_ptr<ExtensionsInfo> GetUninstalledExtensionsInfo() const; | 414 scoped_ptr<ExtensionsInfo> GetUninstalledExtensionsInfo() const; |
| 410 | 415 |
| 411 // Returns the ExtensionInfo from the prefs for the given extension. If the | 416 // Returns the ExtensionInfo from the prefs for the given extension. If the |
| 412 // extension is not present, NULL is returned. | 417 // extension is not present, NULL is returned. |
| 413 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( | 418 scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo( |
| 414 const std::string& extension_id) const; | 419 const std::string& extension_id) const; |
| 415 | 420 |
| 416 // We've downloaded an updated .crx file for the extension, but are waiting | 421 // We've downloaded an updated .crx file for the extension, but are waiting |
| 417 // to install it. | 422 // to install it. |
| 418 // | 423 // |
| 424 // |initial_disable_reason| is the disable reason if |initial_state| is set | |
| 425 // set | |
| 426 // to disable the extension initially, if applicable. | |
|
Finnur
2014/11/11 22:58:03
This is also confusing to read. Can you revise?
| |
| 419 // |install_flags| are a bitmask of extension::InstallFlags. | 427 // |install_flags| are a bitmask of extension::InstallFlags. |
| 420 void SetDelayedInstallInfo(const Extension* extension, | 428 void SetDelayedInstallInfo(const Extension* extension, |
| 421 Extension::State initial_state, | 429 Extension::State initial_state, |
| 430 Extension::DisableReason initial_disable_reason, | |
| 422 int install_flags, | 431 int install_flags, |
| 423 DelayReason delay_reason, | 432 DelayReason delay_reason, |
| 424 const syncer::StringOrdinal& page_ordinal, | 433 const syncer::StringOrdinal& page_ordinal, |
| 425 const std::string& install_parameter); | 434 const std::string& install_parameter); |
| 426 | 435 |
| 427 // Removes any delayed install information we have for the given | 436 // Removes any delayed install information we have for the given |
| 428 // |extension_id|. Returns true if there was info to remove; false otherwise. | 437 // |extension_id|. Returns true if there was info to remove; false otherwise. |
| 429 bool RemoveDelayedInstallInfo(const std::string& extension_id); | 438 bool RemoveDelayedInstallInfo(const std::string& extension_id); |
| 430 | 439 |
| 431 // Update the prefs to finish the update for an extension. | 440 // Update the prefs to finish the update for an extension. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 636 template <class ExtensionIdContainer> | 645 template <class ExtensionIdContainer> |
| 637 void SetExtensionPrefFromContainer(const char* pref, | 646 void SetExtensionPrefFromContainer(const char* pref, |
| 638 const ExtensionIdContainer& strings); | 647 const ExtensionIdContainer& strings); |
| 639 | 648 |
| 640 // Helper function to populate |extension_dict| with the values needed | 649 // Helper function to populate |extension_dict| with the values needed |
| 641 // by a newly installed extension. Work is broken up between this | 650 // by a newly installed extension. Work is broken up between this |
| 642 // function and FinishExtensionInfoPrefs() to accomodate delayed | 651 // function and FinishExtensionInfoPrefs() to accomodate delayed |
| 643 // installations. | 652 // installations. |
| 644 // | 653 // |
| 645 // |install_flags| are a bitmask of extension::InstallFlags. | 654 // |install_flags| are a bitmask of extension::InstallFlags. |
| 646 void PopulateExtensionInfoPrefs(const Extension* extension, | 655 void PopulateExtensionInfoPrefs( |
| 647 const base::Time install_time, | 656 const Extension* extension, |
| 648 Extension::State initial_state, | 657 const base::Time install_time, |
| 649 int install_flags, | 658 Extension::State initial_state, |
| 650 const std::string& install_parameter, | 659 Extension::DisableReason initial_disable_reason, |
| 651 base::DictionaryValue* extension_dict); | 660 int install_flags, |
| 661 const std::string& install_parameter, | |
| 662 base::DictionaryValue* extension_dict); | |
| 652 | 663 |
| 653 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); | 664 void InitExtensionControlledPrefs(ExtensionPrefValueMap* value_map); |
| 654 | 665 |
| 655 // Helper function to complete initialization of the values in | 666 // Helper function to complete initialization of the values in |
| 656 // |extension_dict| for an extension install. Also see | 667 // |extension_dict| for an extension install. Also see |
| 657 // PopulateExtensionInfoPrefs(). | 668 // PopulateExtensionInfoPrefs(). |
| 658 void FinishExtensionInfoPrefs( | 669 void FinishExtensionInfoPrefs( |
| 659 const std::string& extension_id, | 670 const std::string& extension_id, |
| 660 const base::Time install_time, | 671 const base::Time install_time, |
| 661 bool needs_sort_ordinal, | 672 bool needs_sort_ordinal, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 681 bool extensions_disabled_; | 692 bool extensions_disabled_; |
| 682 | 693 |
| 683 ObserverList<ExtensionPrefsObserver> observer_list_; | 694 ObserverList<ExtensionPrefsObserver> observer_list_; |
| 684 | 695 |
| 685 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 696 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 686 }; | 697 }; |
| 687 | 698 |
| 688 } // namespace extensions | 699 } // namespace extensions |
| 689 | 700 |
| 690 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ | 701 #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_H_ |
| OLD | NEW |