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

Unified Diff: chrome/browser/ui/app_list/app_list_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: Rebased Created 5 years 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/app_list_model_builder.h
diff --git a/chrome/browser/ui/app_list/app_list_model_builder.h b/chrome/browser/ui/app_list/app_list_model_builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..35077e6dbfa77869d49fe9370bc5acd8b2805627
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_model_builder.h
@@ -0,0 +1,72 @@
+// 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_APP_LIST_MODEL_BUILDER_H_
+#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_BUILDER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
+#include "ui/app_list/app_list_item_list_observer.h"
+#include "ui/app_list/app_list_model.h"
+
+class AppListControllerDelegate;
+class Profile;
+
+// This abstract class populates and maintains the given |model| with
+// information from |profile| for the specific item type.
+class AppListModelBuilder : public app_list::AppListItemListObserver {
+ public:
+ explicit AppListModelBuilder(AppListControllerDelegate* controller,
jochen (gone - plz use gerrit) 2015/12/03 10:25:39 no explicit, can you clarify whether it takes owne
khmel1 2015/12/03 12:34:49 Removed explicit (left from legacy code with one p
+ const char* item_type);
+ ~AppListModelBuilder() override;
+
+ // Initialize to use app-list sync and sets |service_| to |service|.
jochen (gone - plz use gerrit) 2015/12/03 10:25:39 this comment should tell whether it takes ownershi
khmel1 2015/12/03 12:34:49 Done.
+ void InitializeWithService(app_list::AppListSyncableService* service,
+ app_list::AppListModel* model);
+
+ // Initialize to use extension sync and sets |service_| to NULL. Used in
jochen (gone - plz use gerrit) 2015/12/03 10:25:39 nullptr
khmel1 2015/12/03 12:34:49 Done.
+ // tests and when AppList sync is not enabled.
+ void InitializeWithProfile(Profile* profile, app_list::AppListModel* model);
+
+ protected:
+ // Builds the model with the current profile.
+ virtual void BuildModel() = 0;
+
+ app_list::AppListSyncableService* service() { return service_; }
+
+ Profile* profile() { return profile_; }
+
+ AppListControllerDelegate* controller() { return controller_; }
+
+ app_list::AppListModel* model() { return model_; }
+
+ // Inserts an app based on app ordinal prefs.
+ void InsertApp(scoped_ptr<app_list::AppListItem> app);
+
+ const app_list::AppListSyncableService::SyncItem* GetSyncItem(
+ const std::string& id);
+
+ // Returns app instance matching |id| or NULL.
+ app_list::AppListItem* GetAppItem(const std::string& id);
+
+ private:
+ // Unowned pointers to the service that owns this and associated profile.
+ app_list::AppListSyncableService* service_ = nullptr;
+ Profile* profile_ = nullptr;
+
+ // Unowned pointer to the app list controller.
+ AppListControllerDelegate* controller_;
+
+ // Unowned pointer to the app list model.
+ app_list::AppListModel* model_ = nullptr;
+
+ // Global constant defined for each item type.
+ const char* item_type_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppListModelBuilder);
+};
+
+#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698