OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 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_ARC_APP_MODEL_BUILDER_H_ | |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/ui/app_list/arc_app_prefs.h" | |
13 | |
14 class AppListControllerDelegate; | |
15 class ArcAppItem; | |
16 class Profile; | |
17 | |
18 namespace app_list { | |
19 class AppListModel; | |
20 class AppListSyncableService; | |
21 } | |
22 | |
23 // This class populates and maintains Arc apps. | |
24 class ArcAppModelBuilder : private ArcAppPrefs::Observer { | |
25 public: | |
26 explicit ArcAppModelBuilder(AppListControllerDelegate* controller); | |
27 virtual ~ArcAppModelBuilder(); | |
28 | |
29 void InitializeWithService(app_list::AppListSyncableService* service, | |
30 app_list::AppListModel* model); | |
31 void InitializeWithProfile(Profile* profile, app_list::AppListModel* model); | |
32 | |
33 private: | |
34 // Builds the model with the current profile. | |
35 void BuildModel(); | |
36 // Populates the model with apps. | |
37 void PopulateApps(); | |
38 | |
39 ArcAppItem* GetArcAppItem(const std::string& item_id); | |
40 | |
41 scoped_ptr<ArcAppItem> CreateApp(const std::string& app_id, | |
42 const ArcAppPrefs::AppInfo& info); | |
43 void InsertApp(scoped_ptr<ArcAppItem> app); | |
44 | |
45 Profile* profile_; | |
46 ArcAppPrefs* prefs_; | |
47 AppListControllerDelegate* controller_; | |
48 app_list::AppListModel* model_; | |
49 app_list::AppListSyncableService* service_; | |
xiyuan
2015/11/11 22:15:50
Move data members down.
khmel1
2015/11/12 08:05:30
Done. Also made inheritance public
| |
50 | |
51 // ArcAppPrefs::Observer | |
52 void OnAppRegistered(const std::string& app_id, | |
53 const ArcAppPrefs::AppInfo& app_info) override; | |
54 void OnAppReady(const std::string& app_id, bool ready) override; | |
55 void OnAppIconUpdated(const std::string& app_id, | |
56 ui::ScaleFactor scale_factor) override; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(ArcAppModelBuilder); | |
59 }; | |
60 | |
61 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ | |
OLD | NEW |