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

Side by Side Diff: ash/shell/app_list.cc

Issue 27438002: Store AppItems as pages in AppListModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 2 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 #include <string> 5 #include <string>
6 6
7 #include "ash/session_state_delegate.h" 7 #include "ash/session_state_delegate.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell/example_factory.h" 9 #include "ash/shell/example_factory.h"
10 #include "ash/shell/toplevel_window.h" 10 #include "ash/shell/toplevel_window.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 WindowTypeLauncherItem::Type type_; 188 WindowTypeLauncherItem::Type type_;
189 189
190 DISALLOW_COPY_AND_ASSIGN(ExampleSearchResult); 190 DISALLOW_COPY_AND_ASSIGN(ExampleSearchResult);
191 }; 191 };
192 192
193 class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { 193 class ExampleAppListViewDelegate : public app_list::AppListViewDelegate {
194 public: 194 public:
195 ExampleAppListViewDelegate() : model_(NULL) {} 195 ExampleAppListViewDelegate() : model_(NULL) {}
196 196
197 private: 197 private:
198 void PopulateApps(app_list::AppListModel::Apps* apps) { 198 void PopulateApps() {
199 for (int i = 0; 199 for (int i = 0;
200 i < static_cast<int>(WindowTypeLauncherItem::LAST_TYPE); 200 i < static_cast<int>(WindowTypeLauncherItem::LAST_TYPE);
201 ++i) { 201 ++i) {
202 WindowTypeLauncherItem::Type type = 202 WindowTypeLauncherItem::Type type =
203 static_cast<WindowTypeLauncherItem::Type>(i); 203 static_cast<WindowTypeLauncherItem::Type>(i);
204 std::string id = base::StringPrintf("%d", i); 204 std::string id = base::StringPrintf("%d", i);
205 apps->Add(new WindowTypeLauncherItem(id, type)); 205 model_->AddItem(new WindowTypeLauncherItem(id, type));
206 } 206 }
207 } 207 }
208 208
209 gfx::ImageSkia CreateSearchBoxIcon() { 209 gfx::ImageSkia CreateSearchBoxIcon() {
210 const base::string16 icon_text = ASCIIToUTF16("ash"); 210 const base::string16 icon_text = ASCIIToUTF16("ash");
211 const gfx::Size icon_size(32, 32); 211 const gfx::Size icon_size(32, 32);
212 212
213 gfx::Canvas canvas(icon_size, 1.0f, false /* is_opaque */); 213 gfx::Canvas canvas(icon_size, 1.0f, false /* is_opaque */);
214 canvas.DrawStringInt(icon_text, 214 canvas.DrawStringInt(icon_text,
215 gfx::Font(), 215 gfx::Font(),
(...skipping 10 matching lines...) Expand all
226 search_box_model->SetHintText(ASCIIToUTF16("Type to search...")); 226 search_box_model->SetHintText(ASCIIToUTF16("Type to search..."));
227 } 227 }
228 228
229 // Overridden from ash::AppListViewDelegate: 229 // Overridden from ash::AppListViewDelegate:
230 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE { 230 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {
231 // Nothing needs to be done. 231 // Nothing needs to be done.
232 } 232 }
233 233
234 virtual void InitModel(app_list::AppListModel* model) OVERRIDE { 234 virtual void InitModel(app_list::AppListModel* model) OVERRIDE {
235 model_ = model; 235 model_ = model;
236 PopulateApps(model_->apps()); 236 PopulateApps();
237 DecorateSearchBox(model_->search_box()); 237 DecorateSearchBox(model_->search_box());
238 } 238 }
239 239
240 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE { 240 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE {
241 return NULL; 241 return NULL;
242 } 242 }
243 243
244 virtual void GetShortcutPathForApp( 244 virtual void GetShortcutPathForApp(
245 const std::string& app_id, 245 const std::string& app_id,
246 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE { 246 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 }; 328 };
329 329
330 } // namespace 330 } // namespace
331 331
332 app_list::AppListViewDelegate* CreateAppListViewDelegate() { 332 app_list::AppListViewDelegate* CreateAppListViewDelegate() {
333 return new ExampleAppListViewDelegate; 333 return new ExampleAppListViewDelegate;
334 } 334 }
335 335
336 } // namespace shell 336 } // namespace shell
337 } // namespace ash 337 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/extension_app_model_builder.cc » ('j') | ui/app_list/app_list_item_model.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698