Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: chrome/browser/ui/app_list/app_list_prefs.h

Issue 599343002: Mirror app list hierarchy data in profile prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_list_folder_pref
Patch Set: address comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // An app list item's information. This is enough data to reconstruct the full
33 // hierarchy and ordering information of the app list.
34 struct AppListInfo {
35 enum ItemType {
36 ITEM_TYPE_INVALID = 0,
37 ITEM_TYPE_BEGIN,
38 APP_ITEM = ITEM_TYPE_BEGIN,
39 FOLDER_ITEM,
40
41 // Do not change the order of this enum.
42 // When adding values, remember to update ITEM_TYPE_END.
43 ITEM_TYPE_END = FOLDER_ITEM,
44 };
45 AppListInfo();
46 ~AppListInfo();
47
48 // The id of the folder containing this item.
49 std::string parent_id;
50
51 // The name of this item.
52 std::string name;
53
54 // The position of this item in the app list.
55 syncer::StringOrdinal position;
56
57 // The type of app list item being represented.
58 ItemType item_type;
59 };
60
61 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
62
63 static AppListPrefs* Get(content::BrowserContext* context);
64
65 static AppListPrefs* Create(PrefService* pref_service);
66
67 virtual ~AppListPrefs();
68
69 // Sets the app list info for |id|.
70 void SetAppListInfo(const std::string& id, const AppListInfo& info);
71
72 // Gets the app list info for |id|.
73 scoped_ptr<AppListInfo> GetAppListInfo(const std::string& id) const;
74
75 // Gets a map of all AppListInfo objects in the prefs.
76 void GetAllAppListInfos(std::map<std::string, AppListInfo>* out) const;
77
78 // Deletes the app list info for |id|.
79 void DeleteAppListInfo(const std::string& id);
80
81 private:
82 explicit AppListPrefs(PrefService* pref_service);
83
84 PrefService* pref_service_;
85
86 DISALLOW_COPY_AND_ASSIGN(AppListPrefs);
87 };
88
89 } // namespace app_list
90
91 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698