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

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

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 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/views/ash/app_list/apps_model_builder.h
diff --git a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h b/chrome/browser/ui/views/ash/app_list/apps_model_builder.h
similarity index 38%
rename from chrome/browser/ui/views/ash/app_list/app_list_model_builder.h
rename to chrome/browser/ui/views/ash/app_list/apps_model_builder.h
index d6fd4053261e112dd7de4b720cb7e98b7c82cd7d..2204072c9cca1bf26403adf05858466e9c941f74 100644
--- a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.h
+++ b/chrome/browser/ui/views/ash/app_list/apps_model_builder.h
@@ -2,50 +2,47 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APP_LIST_MODEL_BUILDER_H_
-#define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APP_LIST_MODEL_BUILDER_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APPS_MODEL_BUILDER_H_
+#define CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APPS_MODEL_BUILDER_H_
#pragma once
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
-#include "base/string16.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 AppListModelBuilder : public content::NotificationObserver {
+class AppsModelBuilder : public content::NotificationObserver {
public:
- explicit AppListModelBuilder(Profile* profile);
- virtual ~AppListModelBuilder();
-
- void SetModel(app_list::AppListModel* model);
+ AppsModelBuilder(Profile* profile, app_list::AppListModel::Apps* model);
+ virtual ~AppsModelBuilder();
// Populates the model.
- void Build(const std::string& query);
+ void Build();
private:
- typedef std::vector<app_list::AppListItemModel*> Items;
+ typedef std::vector<app_list::AppListItemModel*> Apps;
- FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, GetExtensionApps);
- FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, SortAndPopulateModel);
- FRIEND_TEST_ALL_PREFIXES(AppListModelBuilderTest, InsertItemByTitle);
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, GetExtensionApps);
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, SortAndPopulateModel);
+ FRIEND_TEST_ALL_PREFIXES(AppsModelBuilderTest, InsertItemByTitle);
- void SortAndPopulateModel(const Items& items);
- void InsertItemByTitle(app_list::AppListItemModel* item);
+ void SortAndPopulateModel(const Apps& apps);
+ void InsertItemByTitle(app_list::AppListItemModel* app);
- void GetExtensionApps(const string16& query, Items* items);
- void CreateSpecialItems();
+ void GetExtensionApps(Apps* apps);
+ void CreateSpecialApps();
- // Returns the index of the application item with |app_id| in |model_|. If
+ // 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 item with |highlight_app_id_| in |model_| as
- // highlighted. If such an item is found, reset |highlight_app_id_| so that it
+ // 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();
@@ -56,21 +53,18 @@ class AppListModelBuilder : public content::NotificationObserver {
Profile* profile_;
- string16 query_;
-
- // The model used by AppListView. It is passed in via SetModel and owned by
- // AppListView.
- app_list::AppListModel* model_;
+ // Sub apps model of AppListModel that represents apps grid view.
+ app_list::AppListModel::Apps* model_;
- // Number of special items in the model. Special items index should be ranged
- // from [0, special_items_count_ - 1].
- size_t special_items_count_;
+ // 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(AppListModelBuilder);
+ DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder);
};
-#endif // CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APP_LIST_MODEL_BUILDER_H_
+#endif // CHROME_BROWSER_UI_VIEWS_ASH_APP_LIST_APPS_MODEL_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698