| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 if (!apps_grid_view_->IsSelectedView(this)) | 300 if (!apps_grid_view_->IsSelectedView(this)) |
| 301 apps_grid_view_->ClearAnySelectedView(); | 301 apps_grid_view_->ClearAnySelectedView(); |
| 302 context_menu_runner_.reset(new views::MenuRunner( | 302 context_menu_runner_.reset(new views::MenuRunner( |
| 303 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); | 303 menu_model, views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); |
| 304 context_menu_runner_->RunMenuAt(GetWidget(), NULL, | 304 context_menu_runner_->RunMenuAt(GetWidget(), NULL, |
| 305 gfx::Rect(point, gfx::Size()), | 305 gfx::Rect(point, gfx::Size()), |
| 306 views::MENU_ANCHOR_TOPLEFT, source_type); | 306 views::MENU_ANCHOR_TOPLEFT, source_type); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void AppListItemView::StateChanged() { | 309 void AppListItemView::StateChanged(ButtonState old_state) { |
| 310 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { | 310 if (state() == STATE_HOVERED || state() == STATE_PRESSED) { |
| 311 shadow_animator_.animation()->Show(); | 311 shadow_animator_.animation()->Show(); |
| 312 // Show the hover/tap highlight: for tap, lighter highlight replaces darker | 312 // Show the hover/tap highlight: for tap, lighter highlight replaces darker |
| 313 // keyboard selection; for mouse hover, keyboard selection takes precedence. | 313 // keyboard selection; for mouse hover, keyboard selection takes precedence. |
| 314 if (!apps_grid_view_->IsSelectedView(this) || state() == STATE_PRESSED) | 314 if (!apps_grid_view_->IsSelectedView(this) || state() == STATE_PRESSED) |
| 315 SetItemIsHighlighted(true); | 315 SetItemIsHighlighted(true); |
| 316 } else { | 316 } else { |
| 317 shadow_animator_.animation()->Hide(); | 317 shadow_animator_.animation()->Hide(); |
| 318 SetItemIsHighlighted(false); | 318 SetItemIsHighlighted(false); |
| 319 if (item_weak_) | 319 if (item_weak_) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 SetItemPercentDownloaded(item_weak_->percent_downloaded()); | 515 SetItemPercentDownloaded(item_weak_->percent_downloaded()); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void AppListItemView::ItemBeingDestroyed() { | 518 void AppListItemView::ItemBeingDestroyed() { |
| 519 DCHECK(item_weak_); | 519 DCHECK(item_weak_); |
| 520 item_weak_->RemoveObserver(this); | 520 item_weak_->RemoveObserver(this); |
| 521 item_weak_ = NULL; | 521 item_weak_ = NULL; |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace app_list | 524 } // namespace app_list |
| OLD | NEW |