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_SORTING_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 ExtensionSorting(ExtensionScopedPrefs* extension_scoped_prefs, | 22 ExtensionSorting(ExtensionScopedPrefs* extension_scoped_prefs, |
23 PrefService* pref_service); | 23 PrefService* pref_service); |
24 ~ExtensionSorting(); | 24 ~ExtensionSorting(); |
25 | 25 |
26 // Set up the ExtensionService to inform of changes that require syncing. | 26 // Set up the ExtensionService to inform of changes that require syncing. |
27 void SetExtensionService(ExtensionServiceInterface* extension_service); | 27 void SetExtensionService(ExtensionServiceInterface* extension_service); |
28 | 28 |
29 // Properly initialize ExtensionSorting internal values that require | 29 // Properly initialize ExtensionSorting internal values that require |
30 // |extension_ids|. | 30 // |extension_ids|. |
31 void Initialize( | 31 void Initialize( |
32 const extensions::ExtensionPrefs::ExtensionIdSet& extension_ids); | 32 const extensions::ExtensionPrefs::ExtensionIds& extension_ids); |
33 | 33 |
34 // Resolves any conflicts the might be created as a result of syncing that | 34 // Resolves any conflicts the might be created as a result of syncing that |
35 // results in two icons having the same page and app launch ordinal. After | 35 // results in two icons having the same page and app launch ordinal. After |
36 // this is called it is guaranteed that there are no collisions of NTP icons. | 36 // this is called it is guaranteed that there are no collisions of NTP icons. |
37 void FixNTPOrdinalCollisions(); | 37 void FixNTPOrdinalCollisions(); |
38 | 38 |
39 // This ensures that the extension has valid ordinals, and if it doesn't then | 39 // This ensures that the extension has valid ordinals, and if it doesn't then |
40 // properly initialize them. | 40 // properly initialize them. |
41 void EnsureValidOrdinals(const std::string& extension_id); | 41 void EnsureValidOrdinals(const std::string& extension_id); |
42 | 42 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // the largest ordinal on |page_ordinal|. If there are no apps on the page | 112 // the largest ordinal on |page_ordinal|. If there are no apps on the page |
113 // then an invalid StringOrdinal is returned. It is an error to call this | 113 // then an invalid StringOrdinal is returned. It is an error to call this |
114 // function with an invalid |page_ordinal|. | 114 // function with an invalid |page_ordinal|. |
115 StringOrdinal GetMinOrMaxAppLaunchOrdinalsOnPage( | 115 StringOrdinal GetMinOrMaxAppLaunchOrdinalsOnPage( |
116 const StringOrdinal& page_ordinal, | 116 const StringOrdinal& page_ordinal, |
117 AppLaunchOrdinalReturn return_type) const; | 117 AppLaunchOrdinalReturn return_type) const; |
118 | 118 |
119 // Initialize the |page_ordinal_map_| with the page ordinals used by the | 119 // Initialize the |page_ordinal_map_| with the page ordinals used by the |
120 // given extensions. | 120 // given extensions. |
121 void InitializePageOrdinalMap( | 121 void InitializePageOrdinalMap( |
122 const extensions::ExtensionPrefs::ExtensionIdSet& extension_ids); | 122 const extensions::ExtensionPrefs::ExtensionIds& extension_ids); |
123 | 123 |
124 // Migrates the app launcher and page index values. | 124 // Migrates the app launcher and page index values. |
125 void MigrateAppIndex( | 125 void MigrateAppIndex( |
126 const extensions::ExtensionPrefs::ExtensionIdSet& extension_ids); | 126 const extensions::ExtensionPrefs::ExtensionIds& extension_ids); |
127 | 127 |
128 // Called to add a new mapping value for |extension_id| with a page ordinal | 128 // Called to add a new mapping value for |extension_id| with a page ordinal |
129 // of |page_ordinal| and a app launch ordinal of |app_launch_ordinal|. This | 129 // of |page_ordinal| and a app launch ordinal of |app_launch_ordinal|. This |
130 // works with valid and invalid StringOrdinals. | 130 // works with valid and invalid StringOrdinals. |
131 void AddOrdinalMapping(const std::string& extension_id, | 131 void AddOrdinalMapping(const std::string& extension_id, |
132 const StringOrdinal& page_ordinal, | 132 const StringOrdinal& page_ordinal, |
133 const StringOrdinal& app_launch_ordinal); | 133 const StringOrdinal& app_launch_ordinal); |
134 | 134 |
135 // Ensures |ntp_ordinal_map_| is of |minimum_size| number of entries. | 135 // Ensures |ntp_ordinal_map_| is of |minimum_size| number of entries. |
136 void CreateOrdinalsIfNecessary(size_t minimum_size); | 136 void CreateOrdinalsIfNecessary(size_t minimum_size); |
(...skipping 28 matching lines...) Expand all Loading... |
165 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the | 165 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the |
166 // contents of that page. | 166 // contents of that page. |
167 typedef std::map< | 167 typedef std::map< |
168 StringOrdinal, AppLaunchOrdinalMap, StringOrdinalLessThan> PageOrdinalMap; | 168 StringOrdinal, AppLaunchOrdinalMap, StringOrdinalLessThan> PageOrdinalMap; |
169 PageOrdinalMap ntp_ordinal_map_; | 169 PageOrdinalMap ntp_ordinal_map_; |
170 | 170 |
171 DISALLOW_COPY_AND_ASSIGN(ExtensionSorting); | 171 DISALLOW_COPY_AND_ASSIGN(ExtensionSorting); |
172 }; | 172 }; |
173 | 173 |
174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ | 174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ |
OLD | NEW |