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

Side by Side Diff: ui/app_list/app_list_model.h

Issue 439703002: Allow app list tiles to show search results in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_APP_LIST_APP_LIST_MODEL_H_ 5 #ifndef UI_APP_LIST_APP_LIST_MODEL_H_
6 #define UI_APP_LIST_APP_LIST_MODEL_H_ 6 #define UI_APP_LIST_APP_LIST_MODEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "ui/app_list/app_list_export.h" 14 #include "ui/app_list/app_list_export.h"
14 #include "ui/app_list/app_list_item_list.h" 15 #include "ui/app_list/app_list_item_list.h"
15 #include "ui/app_list/app_list_item_list_observer.h" 16 #include "ui/app_list/app_list_item_list_observer.h"
17 #include "ui/app_list/search_result.h"
16 #include "ui/base/models/list_model.h" 18 #include "ui/base/models/list_model.h"
17 19
18 namespace app_list { 20 namespace app_list {
19 21
20 class AppListFolderItem; 22 class AppListFolderItem;
21 class AppListItem; 23 class AppListItem;
22 class AppListItemList; 24 class AppListItemList;
23 class AppListModelObserver; 25 class AppListModelObserver;
24 class SearchBoxModel; 26 class SearchBoxModel;
25 class SearchResult;
26 27
27 // Master model of app list that consists of three sub models: AppListItemList, 28 // Master model of app list that consists of three sub models: AppListItemList,
28 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list 29 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list
29 // of AppListItems and is displayed in the grid view. SearchBoxModel is 30 // of AppListItems and is displayed in the grid view. SearchBoxModel is
30 // the model for SearchBoxView. SearchResults owns a list of SearchResult. 31 // the model for SearchBoxView. SearchResults owns a list of SearchResult.
31 // NOTE: Currently this class observes |top_level_item_list_|. The View code may 32 // NOTE: Currently this class observes |top_level_item_list_|. The View code may
32 // move entries in the item list directly (but can not add or remove them) and 33 // move entries in the item list directly (but can not add or remove them) and
33 // the model needs to notify its observers when this occurs. 34 // the model needs to notify its observers when this occurs.
34 class APP_LIST_EXPORT AppListModel : public AppListItemListObserver { 35 class APP_LIST_EXPORT AppListModel : public AppListItemListObserver {
35 public: 36 public:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // appropriate folder. 110 // appropriate folder.
110 void DeleteItem(const std::string& id); 111 void DeleteItem(const std::string& id);
111 112
112 // Call OnExtensionPreferenceChanged() for all items in the model. 113 // Call OnExtensionPreferenceChanged() for all items in the model.
113 void NotifyExtensionPreferenceChanged(); 114 void NotifyExtensionPreferenceChanged();
114 115
115 // Sets wither or not folder UI should be enabled. If |folders_enabled| is 116 // Sets wither or not folder UI should be enabled. If |folders_enabled| is
116 // false, removes any non-OEM folders. 117 // false, removes any non-OEM folders.
117 void SetFoldersEnabled(bool folders_enabled); 118 void SetFoldersEnabled(bool folders_enabled);
118 119
120 // Filters the given |results| by |display_type|. The returned list is
121 // truncated to |max_results|.
122 static std::vector<SearchResult*> GetSearchResultsForDisplayType(
Matt Giuca 2014/08/06 08:54:53 Rename to FilterSearchResultsByDisplayType. ("Get"
calamity 2014/08/12 05:03:36 Done.
123 SearchResults* results,
124 SearchResult::DisplayType display_type,
125 size_t max_results);
126
119 AppListItemList* top_level_item_list() { return top_level_item_list_.get(); } 127 AppListItemList* top_level_item_list() { return top_level_item_list_.get(); }
120 128
121 SearchBoxModel* search_box() { return search_box_.get(); } 129 SearchBoxModel* search_box() { return search_box_.get(); }
122 SearchResults* results() { return results_.get(); } 130 SearchResults* results() { return results_.get(); }
123 Status status() const { return status_; } 131 Status status() const { return status_; }
124 bool folders_enabled() const { return folders_enabled_; } 132 bool folders_enabled() const { return folders_enabled_; }
125 133
126 private: 134 private:
127 // AppListItemListObserver 135 // AppListItemListObserver
128 virtual void OnListItemMoved(size_t from_index, 136 virtual void OnListItemMoved(size_t from_index,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Status status_; 171 Status status_;
164 ObserverList<AppListModelObserver> observers_; 172 ObserverList<AppListModelObserver> observers_;
165 bool folders_enabled_; 173 bool folders_enabled_;
166 174
167 DISALLOW_COPY_AND_ASSIGN(AppListModel); 175 DISALLOW_COPY_AND_ASSIGN(AppListModel);
168 }; 176 };
169 177
170 } // namespace app_list 178 } // namespace app_list
171 179
172 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ 180 #endif // UI_APP_LIST_APP_LIST_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698