| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // is a dictionary object read from the Preferences file, keyed off of | 53 // is a dictionary object read from the Preferences file, keyed off of |
| 54 // extension ids. | 54 // extension ids. |
| 55 static const char kExtensionsPref[]; | 55 static const char kExtensionsPref[]; |
| 56 | 56 |
| 57 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; | 57 typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; |
| 58 | 58 |
| 59 // Vector containing identifiers for preferences. | 59 // Vector containing identifiers for preferences. |
| 60 typedef std::set<std::string> PrefKeySet; | 60 typedef std::set<std::string> PrefKeySet; |
| 61 | 61 |
| 62 // Vector containing identifiers for extensions. | 62 // Vector containing identifiers for extensions. |
| 63 // TODO(yefim): rename to ExtensionIds. |
| 63 typedef std::vector<std::string> ExtensionIdSet; | 64 typedef std::vector<std::string> ExtensionIdSet; |
| 64 | 65 |
| 65 // This enum is used for the launch type the user wants to use for an | 66 // This enum is used for the launch type the user wants to use for an |
| 66 // application. | 67 // application. |
| 67 // Do not remove items or re-order this enum as it is used in preferences | 68 // Do not remove items or re-order this enum as it is used in preferences |
| 68 // and histograms. | 69 // and histograms. |
| 69 enum LaunchType { | 70 enum LaunchType { |
| 70 LAUNCH_PINNED, | 71 LAUNCH_PINNED, |
| 71 LAUNCH_REGULAR, | 72 LAUNCH_REGULAR, |
| 72 LAUNCH_FULLSCREEN, | 73 LAUNCH_FULLSCREEN, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 96 | 97 |
| 97 // Returns true if the specified external extension was uninstalled by the | 98 // Returns true if the specified external extension was uninstalled by the |
| 98 // user. | 99 // user. |
| 99 bool IsExternalExtensionUninstalled(const std::string& id) const; | 100 bool IsExternalExtensionUninstalled(const std::string& id) const; |
| 100 | 101 |
| 101 // Checks whether |extension_id| is disabled. If there's no state pref for | 102 // Checks whether |extension_id| is disabled. If there's no state pref for |
| 102 // the extension, this will return false. Generally you should use | 103 // the extension, this will return false. Generally you should use |
| 103 // ExtensionService::IsExtensionEnabled instead. | 104 // ExtensionService::IsExtensionEnabled instead. |
| 104 bool IsExtensionDisabled(const std::string& id) const; | 105 bool IsExtensionDisabled(const std::string& id) const; |
| 105 | 106 |
| 106 // Get the order that the browser actions appear in the toolbar. | 107 // Get/Set the order that the browser actions appear in the toolbar. |
| 107 std::vector<std::string> GetToolbarOrder(); | 108 ExtensionIdSet GetToolbarOrder(); |
| 109 void SetToolbarOrder(const ExtensionIdSet& extension_ids); |
| 108 | 110 |
| 109 // Set the order that the browser actions appear in the toolbar. | 111 // Get/Set the order that the browser actions appear in the action box. |
| 110 void SetToolbarOrder(const std::vector<std::string>& extension_ids); | 112 ExtensionIdSet GetActionBoxOrder(); |
| 113 void SetActionBoxOrder(const ExtensionIdSet& extension_ids); |
| 111 | 114 |
| 112 // Called when an extension is installed, so that prefs get created. | 115 // Called when an extension is installed, so that prefs get created. |
| 113 // If |page_ordinal| is an invalid ordinal, then a page will be found | 116 // If |page_ordinal| is an invalid ordinal, then a page will be found |
| 114 // for the App. | 117 // for the App. |
| 115 void OnExtensionInstalled(const Extension* extension, | 118 void OnExtensionInstalled(const Extension* extension, |
| 116 Extension::State initial_state, | 119 Extension::State initial_state, |
| 117 bool from_webstore, | 120 bool from_webstore, |
| 118 const StringOrdinal& page_ordinal); | 121 const StringOrdinal& page_ordinal); |
| 119 | 122 |
| 120 // Called when an extension is uninstalled, so that prefs get cleaned up. | 123 // Called when an extension is uninstalled, so that prefs get cleaned up. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 void InitPrefStore(bool extensions_disabled); | 549 void InitPrefStore(bool extensions_disabled); |
| 547 | 550 |
| 548 // Migrates the permissions data in the pref store. | 551 // Migrates the permissions data in the pref store. |
| 549 void MigratePermissions(const ExtensionIdSet& extension_ids); | 552 void MigratePermissions(const ExtensionIdSet& extension_ids); |
| 550 | 553 |
| 551 // Checks whether there is a state pref for the extension and if so, whether | 554 // Checks whether there is a state pref for the extension and if so, whether |
| 552 // it matches |check_state|. | 555 // it matches |check_state|. |
| 553 bool DoesExtensionHaveState(const std::string& id, | 556 bool DoesExtensionHaveState(const std::string& id, |
| 554 Extension::State check_state) const; | 557 Extension::State check_state) const; |
| 555 | 558 |
| 559 // Helper function to Get/Set array of strings from/to prefs. |
| 560 ExtensionIdSet GetExtensionPrefAsVector(const char* pref); |
| 561 void SetExtensionPrefFromVector(const char* pref, |
| 562 const ExtensionIdSet& extension_ids); |
| 563 |
| 556 // The pref service specific to this set of extension prefs. Owned by profile. | 564 // The pref service specific to this set of extension prefs. Owned by profile. |
| 557 PrefService* prefs_; | 565 PrefService* prefs_; |
| 558 | 566 |
| 559 // Base extensions install directory. | 567 // Base extensions install directory. |
| 560 FilePath install_directory_; | 568 FilePath install_directory_; |
| 561 | 569 |
| 562 // Weak pointer, owned by Profile. | 570 // Weak pointer, owned by Profile. |
| 563 ExtensionPrefValueMap* extension_pref_value_map_; | 571 ExtensionPrefValueMap* extension_pref_value_map_; |
| 564 | 572 |
| 565 // Contains all the logic for handling the order for various extension | 573 // Contains all the logic for handling the order for various extension |
| 566 // properties. | 574 // properties. |
| 567 scoped_ptr<ExtensionSorting> extension_sorting_; | 575 scoped_ptr<ExtensionSorting> extension_sorting_; |
| 568 | 576 |
| 569 scoped_refptr<ContentSettingsStore> content_settings_store_; | 577 scoped_refptr<ContentSettingsStore> content_settings_store_; |
| 570 | 578 |
| 571 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); | 579 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); |
| 572 }; | 580 }; |
| 573 | 581 |
| 574 } // namespace extensions | 582 } // namespace extensions |
| 575 | 583 |
| 576 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ | 584 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ |
| OLD | NEW |