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

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

Issue 10957048: app_list: Use NTP ordering in ExtensionSorting to sort apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/app_list/apps_model_builder.h
diff --git a/chrome/browser/ui/app_list/apps_model_builder.h b/chrome/browser/ui/app_list/apps_model_builder.h
index 97e2350f34277910de95138b98c98426ab442a19..5d7c700617dfd8f75159df5296db1e4b7a1d1160 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.h
+++ b/chrome/browser/ui/app_list/apps_model_builder.h
@@ -6,14 +6,15 @@
#define CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_
#include <string>
-#include <vector>
#include "base/gtest_prod_util.h"
+#include "chrome/browser/api/prefs/pref_change_registrar.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/app_list/app_list_model.h"
class AppListController;
+class ExtensionAppItem;
class Profile;
class AppsModelBuilder : public content::NotificationObserver {
@@ -27,17 +28,17 @@ class AppsModelBuilder : public content::NotificationObserver {
void Build();
private:
- typedef std::vector<app_list::AppListItemModel*> Apps;
+ // Populates the model with apps.
+ void PopulateApps();
- FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, GetExtensionApps);
- FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, SortAndPopulateModel);
- FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, InsertItemByTitle);
+ // Gets start and end index of app items in the model.
+ void GetAppsRange(size_t* start, size_t* end);
- void SortAndPopulateModel(const Apps& apps);
- void InsertItemByTitle(app_list::AppListItemModel* app);
+ // Re-sort apps in case app ordinal prefs are changed.
+ void ResortApps();
- void GetExtensionApps(Apps* apps);
- void CreateSpecialApps();
+ // Inserts an app based on app ordinal prefs.
+ void InsertApp(ExtensionAppItem* app);
// Returns the index of the application app with |app_id| in |model_|. If
// no match is found, returns -1.
@@ -48,6 +49,9 @@ class AppsModelBuilder : public content::NotificationObserver {
// is highlighted once per install notification.
void HighlightApp();
+ // Returns app instance at given |index|.
+ ExtensionAppItem* GetAppAt(size_t index);
+
// content::NotificationObserver
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -59,13 +63,10 @@ class AppsModelBuilder : public content::NotificationObserver {
// 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_;
+ PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder);
};
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/apps_model_builder.cc » ('j') | chrome/browser/ui/app_list/apps_model_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698