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