Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/ui/app_list/arc_app_list_prefs.h" | |
| 14 | |
| 15 class AppListControllerDelegate; | |
| 16 class ArcAppItem; | |
| 17 class Profile; | |
| 18 | |
| 19 namespace app_list { | |
| 20 class AppListModel; | |
| 21 class AppListSyncableService; | |
| 22 } | |
| 23 | |
| 24 // This class populates and maintains ARC apps. | |
| 25 class ArcAppModelBuilder : public ArcAppListPrefs::Observer { | |
|
Matt Giuca
2015/11/19 09:12:35
I wanted to take another look over this CL to see
khmel1
2015/11/19 17:11:41
Hi Matt, Thank you for taking second round for thi
| |
| 26 public: | |
| 27 explicit ArcAppModelBuilder(AppListControllerDelegate* controller); | |
| 28 virtual ~ArcAppModelBuilder(); | |
| 29 | |
| 30 void InitializeWithService(app_list::AppListSyncableService* service, | |
| 31 app_list::AppListModel* model); | |
| 32 void InitializeWithProfile(Profile* profile, app_list::AppListModel* model); | |
| 33 | |
| 34 // ArcAppListPrefs::Observer | |
| 35 void OnAppRegistered(const std::string& app_id, | |
| 36 const ArcAppListPrefs::AppInfo& app_info) override; | |
| 37 void OnAppReadyChanged(const std::string& app_id, bool ready) override; | |
| 38 void OnAppIconUpdated(const std::string& app_id, | |
| 39 ui::ScaleFactor scale_factor) override; | |
| 40 | |
| 41 private: | |
| 42 // Builds the model with the current profile. | |
| 43 void BuildModel(); | |
| 44 // Populates the model with apps. | |
| 45 void PopulateApps(); | |
| 46 | |
| 47 ArcAppItem* GetArcAppItem(const std::string& item_id); | |
| 48 | |
| 49 scoped_ptr<ArcAppItem> CreateApp(const std::string& app_id, | |
| 50 const ArcAppListPrefs::AppInfo& info); | |
| 51 void InsertApp(scoped_ptr<ArcAppItem> app); | |
| 52 | |
| 53 Profile* profile_ = nullptr; | |
| 54 ArcAppListPrefs* prefs_ = nullptr; | |
| 55 AppListControllerDelegate* controller_; | |
| 56 app_list::AppListModel* model_ = nullptr; | |
| 57 app_list::AppListSyncableService* service_ = nullptr; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ArcAppModelBuilder); | |
| 60 }; | |
| 61 | |
| 62 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ | |
| OLD | NEW |