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

Unified Diff: chrome/browser/ui/app_list/arc_app_model_builder.h

Issue 1413153007: arc-app-launcher: Minimal support for ARC app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert wrongly update chrome/chrome_browser_ui.gypi Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..3e3a616384e9ca15cd3aa7a45c1c101953bfdef5
--- /dev/null
+++ b/chrome/browser/ui/app_list/arc_app_model_builder.h
@@ -0,0 +1,62 @@
+// Copyright 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 <vector>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/app_list/arc_app_list_prefs.h"
+
+class AppListControllerDelegate;
+class ArcAppItem;
+class Profile;
+
+namespace app_list {
+class AppListModel;
+class AppListSyncableService;
+}
+
+// This class populates and maintains ARC apps.
+class ArcAppModelBuilder : public ArcAppListPrefs::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);
+
+ // ArcAppListPrefs::Observer
+ void OnAppRegistered(const std::string& app_id,
+ const ArcAppListPrefs::AppInfo& app_info) override;
+ void OnAppReadyChanged(const std::string& app_id, bool ready) override;
+ void OnAppIconUpdated(const std::string& app_id,
+ ui::ScaleFactor scale_factor) override;
+
+ 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 ArcAppListPrefs::AppInfo& info);
+ void InsertApp(scoped_ptr<ArcAppItem> app);
+
+ Profile* profile_ = nullptr;
+ ArcAppListPrefs* prefs_ = nullptr;
+ AppListControllerDelegate* controller_;
+ app_list::AppListModel* model_ = nullptr;
+ app_list::AppListSyncableService* service_ = nullptr;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcAppModelBuilder);
+};
+
+#endif // CHROME_BROWSER_UI_APP_LIST_ARC_APP_MODEL_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698