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

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

Issue 2790773002: Cleanup MenuRunner API (Closed)
Patch Set: Rebase Created 3 years, 8 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 "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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void AppListItemView::ShowContextMenuForView(views::View* source, 282 void AppListItemView::ShowContextMenuForView(views::View* source,
283 const gfx::Point& point, 283 const gfx::Point& point,
284 ui::MenuSourceType source_type) { 284 ui::MenuSourceType source_type) {
285 ui::MenuModel* menu_model = 285 ui::MenuModel* menu_model =
286 item_weak_ ? item_weak_->GetContextMenuModel() : NULL; 286 item_weak_ ? item_weak_->GetContextMenuModel() : NULL;
287 if (!menu_model) 287 if (!menu_model)
288 return; 288 return;
289 289
290 if (!apps_grid_view_->IsSelectedView(this)) 290 if (!apps_grid_view_->IsSelectedView(this))
291 apps_grid_view_->ClearAnySelectedView(); 291 apps_grid_view_->ClearAnySelectedView();
292 context_menu_runner_.reset(new views::MenuRunner( 292 context_menu_runner_.reset(
293 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); 293 new views::MenuRunner(menu_model, views::MenuRunner::HAS_MNEMONICS));
294 context_menu_runner_->RunMenuAt(GetWidget(), NULL, 294 context_menu_runner_->RunMenuAt(GetWidget(), NULL,
295 gfx::Rect(point, gfx::Size()), 295 gfx::Rect(point, gfx::Size()),
296 views::MENU_ANCHOR_TOPLEFT, source_type); 296 views::MENU_ANCHOR_TOPLEFT, source_type);
297 } 297 }
298 298
299 void AppListItemView::StateChanged(ButtonState old_state) { 299 void AppListItemView::StateChanged(ButtonState old_state) {
300 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { 300 if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
301 shadow_animator_.animation()->Show(); 301 shadow_animator_.animation()->Show();
302 // Show the hover/tap highlight: for tap, lighter highlight replaces darker 302 // Show the hover/tap highlight: for tap, lighter highlight replaces darker
303 // keyboard selection; for mouse hover, keyboard selection takes precedence. 303 // keyboard selection; for mouse hover, keyboard selection takes precedence.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 SetItemPercentDownloaded(item_weak_->percent_downloaded()); 505 SetItemPercentDownloaded(item_weak_->percent_downloaded());
506 } 506 }
507 507
508 void AppListItemView::ItemBeingDestroyed() { 508 void AppListItemView::ItemBeingDestroyed() {
509 DCHECK(item_weak_); 509 DCHECK(item_weak_);
510 item_weak_->RemoveObserver(this); 510 item_weak_->RemoveObserver(this);
511 item_weak_ = NULL; 511 item_weak_ = NULL;
512 } 512 }
513 513
514 } // namespace app_list 514 } // namespace app_list
OLDNEW
« no previous file with comments | « mash/example/window_type_launcher/window_type_launcher.cc ('k') | ui/app_list/views/search_result_tile_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698