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

Unified Diff: chrome/browser/ui/ash/app_list/apps_model_builder.h

Issue 10828151: chrome: Copy app_list files from views/ to ash/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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/ash/app_list/apps_model_builder.h
diff --git a/chrome/browser/ui/ash/app_list/apps_model_builder.h b/chrome/browser/ui/ash/app_list/apps_model_builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..65c3b656531970ae0eace7d76923bbcee94e6ed6
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/apps_model_builder.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2012 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_ASH_APP_LIST_APPS_MODEL_BUILDER_H_
+#define CHROME_BROWSER_UI_ASH_APP_LIST_APPS_MODEL_BUILDER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/gtest_prod_util.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "ui/app_list/app_list_model.h"
+
+class Profile;
+
+class AppsModelBuilder : public content::NotificationObserver {
+ public:
+ AppsModelBuilder(Profile* profile, app_list::AppListModel::Apps* model);
+ virtual ~AppsModelBuilder();
+
+ // Populates the model.
+ void Build();
+
+ private:
+ typedef std::vector<app_list::AppListItemModel*> Apps;
+
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, GetExtensionApps);
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, SortAndPopulateModel);
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, InsertItemByTitle);
+
+ void SortAndPopulateModel(const Apps& apps);
+ void InsertItemByTitle(app_list::AppListItemModel* app);
+
+ void GetExtensionApps(Apps* apps);
+ void CreateSpecialApps();
+
+ // Returns the index of the application app with |app_id| in |model_|. If
+ // no match is found, returns -1.
+ int FindApp(const std::string& app_id);
+
+ // Sets the application app with |highlight_app_id_| in |model_| as
+ // highlighted. If such an app is found, reset |highlight_app_id_| so that it
+ // is highlighted once per install notification.
+ void HighlightApp();
+
+ // content::NotificationObserver
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ Profile* profile_;
+
+ // Sub apps model of AppListModel that represents apps grid view.
+ app_list::AppListModel::Apps* model_;
+
+ // Number of special apps in the model. Special apps index should be ranged
+ // from [0, special_apps_count_ - 1].
+ int special_apps_count_;
+
+ std::string highlight_app_id_;
+
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder);
+};
+
+#endif // CHROME_BROWSER_UI_ASH_APP_LIST_APPS_MODEL_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698