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

Side by Side Diff: ui/app_list/views/app_list_item_view.cc

Issue 2272023002: Turn AppList context menus Async (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | ui/app_list/views/app_list_menu_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/app_list/views/app_list_item_view.h" 5 #include "ui/app_list/views/app_list_item_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void AppListItemView::ShowContextMenuForView(views::View* source, 297 void AppListItemView::ShowContextMenuForView(views::View* source,
298 const gfx::Point& point, 298 const gfx::Point& point,
299 ui::MenuSourceType source_type) { 299 ui::MenuSourceType source_type) {
300 ui::MenuModel* menu_model = 300 ui::MenuModel* menu_model =
301 item_weak_ ? item_weak_->GetContextMenuModel() : NULL; 301 item_weak_ ? item_weak_->GetContextMenuModel() : NULL;
302 if (!menu_model) 302 if (!menu_model)
303 return; 303 return;
304 304
305 if (!apps_grid_view_->IsSelectedView(this)) 305 if (!apps_grid_view_->IsSelectedView(this))
306 apps_grid_view_->ClearAnySelectedView(); 306 apps_grid_view_->ClearAnySelectedView();
307 context_menu_runner_.reset( 307 context_menu_runner_.reset(new views::MenuRunner(
308 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS)); 308 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC));
309 if (context_menu_runner_->RunMenuAt(GetWidget(), 309 context_menu_runner_->RunMenuAt(GetWidget(), NULL,
310 NULL, 310 gfx::Rect(point, gfx::Size()),
311 gfx::Rect(point, gfx::Size()), 311 views::MENU_ANCHOR_TOPLEFT, source_type);
312 views::MENU_ANCHOR_TOPLEFT,
313 source_type) ==
314 views::MenuRunner::MENU_DELETED) {
315 return;
316 }
317 } 312 }
318 313
319 void AppListItemView::StateChanged() { 314 void AppListItemView::StateChanged() {
320 if (app_list::switches::IsExperimentalAppListEnabled()) { 315 if (app_list::switches::IsExperimentalAppListEnabled()) {
321 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 316 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
322 shadow_animator_.animation()->Show(); 317 shadow_animator_.animation()->Show();
323 } else { 318 } else {
324 shadow_animator_.animation()->Hide(); 319 shadow_animator_.animation()->Hide();
325 } 320 }
326 } 321 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 SetItemPercentDownloaded(item_weak_->percent_downloaded()); 526 SetItemPercentDownloaded(item_weak_->percent_downloaded());
532 } 527 }
533 528
534 void AppListItemView::ItemBeingDestroyed() { 529 void AppListItemView::ItemBeingDestroyed() {
535 DCHECK(item_weak_); 530 DCHECK(item_weak_);
536 item_weak_->RemoveObserver(this); 531 item_weak_->RemoveObserver(this);
537 item_weak_ = NULL; 532 item_weak_ = NULL;
538 } 533 }
539 534
540 } // namespace app_list 535 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/app_list_menu_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698