OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |