| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROME_APP_SORTING_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual syncer::StringOrdinal GetPageOrdinal( | 55 virtual syncer::StringOrdinal GetPageOrdinal( |
| 56 const std::string& extension_id) const OVERRIDE; | 56 const std::string& extension_id) const OVERRIDE; |
| 57 virtual void SetPageOrdinal( | 57 virtual void SetPageOrdinal( |
| 58 const std::string& extension_id, | 58 const std::string& extension_id, |
| 59 const syncer::StringOrdinal& new_page_ordinal) OVERRIDE; | 59 const syncer::StringOrdinal& new_page_ordinal) OVERRIDE; |
| 60 virtual void ClearOrdinals(const std::string& extension_id) OVERRIDE; | 60 virtual void ClearOrdinals(const std::string& extension_id) OVERRIDE; |
| 61 virtual int PageStringOrdinalAsInteger( | 61 virtual int PageStringOrdinalAsInteger( |
| 62 const syncer::StringOrdinal& page_ordinal) const OVERRIDE; | 62 const syncer::StringOrdinal& page_ordinal) const OVERRIDE; |
| 63 virtual syncer::StringOrdinal PageIntegerAsStringOrdinal( | 63 virtual syncer::StringOrdinal PageIntegerAsStringOrdinal( |
| 64 size_t page_index) OVERRIDE; | 64 size_t page_index) OVERRIDE; |
| 65 virtual void MarkExtensionAsHidden(const std::string& extension_id) OVERRIDE; | 65 virtual void SetExtensionVisible(const std::string& extension_id, |
| 66 bool visible) OVERRIDE; |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // The StringOrdinal is the app launch ordinal and the string is the extension | 69 // The StringOrdinal is the app launch ordinal and the string is the extension |
| 69 // id. | 70 // id. |
| 70 typedef std::multimap< | 71 typedef std::multimap< |
| 71 syncer::StringOrdinal, std::string, | 72 syncer::StringOrdinal, std::string, |
| 72 syncer::StringOrdinal::LessThanFn> AppLaunchOrdinalMap; | 73 syncer::StringOrdinal::LessThanFn> AppLaunchOrdinalMap; |
| 73 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the | 74 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the |
| 74 // contents of that page. | 75 // contents of that page. |
| 75 typedef std::map< | 76 typedef std::map< |
| 76 syncer::StringOrdinal, AppLaunchOrdinalMap, | 77 syncer::StringOrdinal, AppLaunchOrdinalMap, |
| 77 syncer::StringOrdinal::LessThanFn> PageOrdinalMap; | 78 syncer::StringOrdinal::LessThanFn> PageOrdinalMap; |
| 78 | 79 |
| 79 // Unit tests. | 80 // Unit tests. |
| 80 friend class ChromeAppSortingDefaultOrdinalsBase; | 81 friend class ChromeAppSortingDefaultOrdinalsBase; |
| 81 friend class ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage; | 82 friend class ChromeAppSortingGetMinOrMaxAppLaunchOrdinalsOnPage; |
| 82 friend class ChromeAppSortingInitializeWithNoApps; | 83 friend class ChromeAppSortingInitializeWithNoApps; |
| 83 friend class ChromeAppSortingPageOrdinalMapping; | 84 friend class ChromeAppSortingPageOrdinalMapping; |
| 85 friend class ChromeAppSortingSetExtensionVisible; |
| 84 | 86 |
| 85 // An enum used by GetMinOrMaxAppLaunchOrdinalsOnPage to specify which | 87 // An enum used by GetMinOrMaxAppLaunchOrdinalsOnPage to specify which |
| 86 // value should be returned. | 88 // value should be returned. |
| 87 enum AppLaunchOrdinalReturn {MIN_ORDINAL, MAX_ORDINAL}; | 89 enum AppLaunchOrdinalReturn {MIN_ORDINAL, MAX_ORDINAL}; |
| 88 | 90 |
| 89 // Maps an app id to its ordinals. | 91 // Maps an app id to its ordinals. |
| 90 struct AppOrdinals { | 92 struct AppOrdinals { |
| 91 AppOrdinals(); | 93 AppOrdinals(); |
| 92 ~AppOrdinals(); | 94 ~AppOrdinals(); |
| 93 | 95 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 179 |
| 178 // The set of extensions that don't appear in the new tab page. | 180 // The set of extensions that don't appear in the new tab page. |
| 179 std::set<std::string> ntp_hidden_extensions_; | 181 std::set<std::string> ntp_hidden_extensions_; |
| 180 | 182 |
| 181 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting); | 183 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting); |
| 182 }; | 184 }; |
| 183 | 185 |
| 184 } // namespace extensions | 186 } // namespace extensions |
| 185 | 187 |
| 186 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ | 188 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ |
| OLD | NEW |