Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_PREFS_H_ | |
| 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_PREFS_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/observer_list.h" | |
| 14 #include "base/values.h" | |
| 15 #include "components/keyed_service/core/keyed_service.h" | |
| 16 #include "sync/api/string_ordinal.h" | |
| 17 | |
| 18 class PrefService; | |
| 19 | |
| 20 namespace content { | |
| 21 class BrowserContext; | |
| 22 } | |
| 23 | |
| 24 namespace user_prefs { | |
| 25 class PrefRegistrySyncable; | |
| 26 } | |
| 27 | |
| 28 namespace app_list { | |
| 29 | |
| 30 class AppListPrefs : public KeyedService { | |
| 31 public: | |
| 32 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 33 | |
| 34 static AppListPrefs* Get(content::BrowserContext* context); | |
| 35 | |
| 36 static AppListPrefs* Create(PrefService* pref_service); | |
| 37 | |
| 38 // An app list item's information. This is enough data to reconstruct the full | |
| 39 // hierarchy and ordering information of the app list. | |
| 40 struct AppListInfo { | |
|
Matt Giuca
2014/09/30 02:49:47
This definition should appear before the methods.
calamity
2014/09/30 05:40:08
Done.
| |
| 41 enum ItemType { | |
| 42 ITEM_TYPE_INVALID = 0, | |
| 43 ITEM_TYPE_BEGIN, | |
| 44 APP_ITEM = ITEM_TYPE_BEGIN, | |
| 45 FOLDER_ITEM, | |
| 46 | |
| 47 // Do not change the order of this enum. | |
| 48 // When adding values, remember to update ITEM_TYPE_END. | |
| 49 ITEM_TYPE_END = FOLDER_ITEM, | |
|
stevenjb
2014/09/26 16:22:16
nit: I think it would be simpler to explicitly ass
Matt Giuca
2014/09/30 02:49:47
I agree. You currently only use ITEM_TYPE_BEGIN/IT
calamity
2014/09/30 05:40:08
I'm using the begin and end values for validity ch
Matt Giuca
2014/09/30 06:04:42
Acknowledged.
| |
| 50 }; | |
| 51 explicit AppListInfo(const base::DictionaryValue* item_dict); | |
|
stevenjb
2014/09/26 16:22:16
nit: Multiple constructors like this can be confus
Matt Giuca
2014/09/30 02:49:47
+1
(You could also add another constructor that t
calamity
2014/09/30 05:40:08
Done.
| |
| 52 AppListInfo(); | |
| 53 ~AppListInfo(); | |
| 54 | |
| 55 // The id of the folder containing this item. | |
| 56 std::string folder_id; | |
|
stevenjb
2014/09/26 16:22:16
All of the sync code uses 'parent_id', we should b
calamity
2014/09/30 05:40:08
Done.
| |
| 57 | |
| 58 // The name of this item. | |
| 59 std::string name; | |
| 60 | |
| 61 // The position of this item in the app list. | |
| 62 syncer::StringOrdinal position; | |
|
stevenjb
2014/09/26 16:22:16
We currently do not use the page_ordinal field fro
Matt Giuca
2014/09/30 02:49:47
We're explicitly trying to avoid having page_ordin
calamity
2014/09/30 05:40:08
The page ordinal field is completely unused at the
stevenjb
2014/09/30 18:16:23
We should probably have an "App Launcher" meeting
| |
| 63 | |
| 64 // The type of app list item being represented. | |
| 65 ItemType item_type; | |
| 66 }; | |
| 67 | |
| 68 virtual ~AppListPrefs(); | |
| 69 | |
| 70 // Sets the app list info for |id|. | |
| 71 void SetAppListInfo(const std::string& id, const AppListInfo& info); | |
| 72 | |
| 73 // Gets the app list info for |id|. | |
| 74 scoped_ptr<AppListInfo> GetAppListInfo(const std::string& id) const; | |
| 75 | |
| 76 // Gets a map of all AppListInfo objects in the prefs. | |
| 77 std::map<std::string, AppListInfo> GetAllAppListInfos() const; | |
|
stevenjb
2014/09/26 16:22:16
This is passing a potentially very large map by va
calamity
2014/09/30 05:40:08
Done.
| |
| 78 | |
| 79 // Deletes the app list info for |id|. | |
| 80 void DeleteAppListInfo(const std::string& id); | |
| 81 | |
| 82 private: | |
| 83 explicit AppListPrefs(PrefService* pref_service); | |
| 84 | |
| 85 PrefService* pref_service_; | |
| 86 | |
| 87 DISALLOW_COPY_AND_ASSIGN(AppListPrefs); | |
| 88 }; | |
| 89 | |
| 90 } // namespace app_list | |
| 91 | |
| 92 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_PREFS_H_ | |
| OLD | NEW |