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

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

Issue 2339523004: Remove old (dead) app list code. (Closed)
Patch Set: Address nonbistytftatl review. Created 4 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 unified diff | Download patch
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) { 209 for (int i = 0; i < static_cast<int>(WindowTypeShelfItem::LAST_TYPE); ++i) {
210 WindowTypeShelfItem::Type type = 210 WindowTypeShelfItem::Type type =
211 static_cast<WindowTypeShelfItem::Type>(i); 211 static_cast<WindowTypeShelfItem::Type>(i);
212 std::string id = base::IntToString(i); 212 std::string id = base::IntToString(i);
213 std::unique_ptr<WindowTypeShelfItem> shelf_item( 213 std::unique_ptr<WindowTypeShelfItem> shelf_item(
214 new WindowTypeShelfItem(id, type)); 214 new WindowTypeShelfItem(id, type));
215 model_->AddItem(std::move(shelf_item)); 215 model_->AddItem(std::move(shelf_item));
216 } 216 }
217 } 217 }
218 218
219 gfx::ImageSkia CreateSearchBoxIcon() {
220 const base::string16 icon_text = base::ASCIIToUTF16("ash");
221 const gfx::Size icon_size(32, 32);
222
223 gfx::Canvas canvas(icon_size, 1.0f, false /* is_opaque */);
224 canvas.DrawStringRectWithFlags(
225 icon_text, gfx::FontList(), SK_ColorBLACK, gfx::Rect(icon_size),
226 gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_SUBPIXEL_RENDERING);
227
228 return gfx::ImageSkia(canvas.ExtractImageRep());
229 }
230
231 void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) { 219 void DecorateSearchBox(app_list::SearchBoxModel* search_box_model) {
232 search_box_model->SetIcon(CreateSearchBoxIcon());
233 search_box_model->SetHintText(base::ASCIIToUTF16("Type to search...")); 220 search_box_model->SetHintText(base::ASCIIToUTF16("Type to search..."));
234 } 221 }
235 222
236 // Overridden from app_list::AppListViewDelegate: 223 // Overridden from app_list::AppListViewDelegate:
237 bool ForceNativeDesktop() const override { return false; } 224 bool ForceNativeDesktop() const override { return false; }
238 225
239 void SetProfileByPath(const base::FilePath& profile_path) override { 226 void SetProfileByPath(const base::FilePath& profile_path) override {
240 // Nothing needs to be done. 227 // Nothing needs to be done.
241 } 228 }
242 229
243 const Users& GetUsers() const override { return users_; } 230 const Users& GetUsers() const override { return users_; }
244 231
245 bool ShouldCenterWindow() const override { return false; }
246
247 app_list::AppListModel* GetModel() override { return model_.get(); } 232 app_list::AppListModel* GetModel() override { return model_.get(); }
248 233
249 app_list::SpeechUIModel* GetSpeechUI() override { return &speech_ui_; } 234 app_list::SpeechUIModel* GetSpeechUI() override { return &speech_ui_; }
250 235
251 void OpenSearchResult(app_list::SearchResult* result, 236 void OpenSearchResult(app_list::SearchResult* result,
252 bool auto_launch, 237 bool auto_launch,
253 int event_flags) override { 238 int event_flags) override {
254 const ExampleSearchResult* example_result = 239 const ExampleSearchResult* example_result =
255 static_cast<const ExampleSearchResult*>(result); 240 static_cast<const ExampleSearchResult*>(result);
256 WindowTypeShelfItem::ActivateItem(example_result->type(), event_flags); 241 WindowTypeShelfItem::ActivateItem(example_result->type(), event_flags);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 }; 328 };
344 329
345 } // namespace 330 } // namespace
346 331
347 app_list::AppListViewDelegate* CreateAppListViewDelegate() { 332 app_list::AppListViewDelegate* CreateAppListViewDelegate() {
348 return new ExampleAppListViewDelegate; 333 return new ExampleAppListViewDelegate;
349 } 334 }
350 335
351 } // namespace shell 336 } // namespace shell
352 } // namespace ash 337 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698