Index: chrome/browser/ui/app_list/arc_app_model_builder.h |
diff --git a/chrome/browser/ui/app_list/arc_app_model_builder.h b/chrome/browser/ui/app_list/arc_app_model_builder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7befe4c7a28e0b5e478e0aa947ff48c400c110b9 |
--- /dev/null |
+++ b/chrome/browser/ui/app_list/arc_app_model_builder.h |
@@ -0,0 +1,61 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ |
+#define CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/ui/app_list/arc_app_prefs.h" |
+ |
+class AppListControllerDelegate; |
+class ArcAppItem; |
+class Profile; |
+ |
+namespace app_list { |
+class AppListModel; |
+class AppListSyncableService; |
+} |
+ |
+// This class populates and maintains Arc apps. |
+class ArcAppModelBuilder : private ArcAppPrefs::Observer { |
+ public: |
+ explicit ArcAppModelBuilder(AppListControllerDelegate* controller); |
+ virtual ~ArcAppModelBuilder(); |
+ |
+ void InitializeWithService(app_list::AppListSyncableService* service, |
+ app_list::AppListModel* model); |
+ void InitializeWithProfile(Profile* profile, app_list::AppListModel* model); |
+ |
+ private: |
+ // Builds the model with the current profile. |
+ void BuildModel(); |
+ // Populates the model with apps. |
+ void PopulateApps(); |
+ |
+ ArcAppItem* GetArcAppItem(const std::string& item_id); |
+ |
+ scoped_ptr<ArcAppItem> CreateApp(const std::string& app_id, |
+ const ArcAppPrefs::AppInfo& info); |
+ void InsertApp(scoped_ptr<ArcAppItem> app); |
+ |
+ Profile* profile_; |
+ ArcAppPrefs* prefs_; |
+ AppListControllerDelegate* controller_; |
+ app_list::AppListModel* model_; |
+ 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
|
+ |
+ // ArcAppPrefs::Observer |
+ void OnAppRegistered(const std::string& app_id, |
+ const ArcAppPrefs::AppInfo& app_info) override; |
+ void OnAppReady(const std::string& app_id, bool ready) override; |
+ void OnAppIconUpdated(const std::string& app_id, |
+ ui::ScaleFactor scale_factor) override; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ArcAppModelBuilder); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_ |