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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return; | 137 return; |
138 } | 138 } |
139 | 139 |
140 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( | 140 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( |
141 icon, | 141 icon, |
142 skia::ImageOperations::RESIZE_BEST, | 142 skia::ImageOperations::RESIZE_BEST, |
143 gfx::Size(kGridIconDimension, kGridIconDimension))); | 143 gfx::Size(kGridIconDimension, kGridIconDimension))); |
144 shadow_animator_.SetOriginalImage(resized); | 144 shadow_animator_.SetOriginalImage(resized); |
145 } | 145 } |
146 | 146 |
147 void AppListItemView::SetUIState(UIState state) { | 147 void AppListItemView::SetUIState(UIState ui_state) { |
148 if (ui_state_ == state) | 148 if (ui_state_ == ui_state) |
149 return; | 149 return; |
150 | 150 |
151 ui_state_ = state; | 151 ui_state_ = ui_state; |
152 | 152 |
153 switch (ui_state_) { | 153 switch (ui_state_) { |
154 case UI_STATE_NORMAL: | 154 case UI_STATE_NORMAL: |
155 title_->SetVisible(!is_installing_); | 155 title_->SetVisible(!is_installing_); |
156 progress_bar_->SetVisible(is_installing_); | 156 progress_bar_->SetVisible(is_installing_); |
157 break; | 157 break; |
158 case UI_STATE_DRAGGING: | 158 case UI_STATE_DRAGGING: |
159 title_->SetVisible(false); | 159 title_->SetVisible(false); |
160 progress_bar_->SetVisible(false); | 160 progress_bar_->SetVisible(false); |
161 break; | 161 break; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 break; | 460 break; |
461 case ui::ET_GESTURE_SCROLL_END: | 461 case ui::ET_GESTURE_SCROLL_END: |
462 case ui::ET_SCROLL_FLING_START: | 462 case ui::ET_SCROLL_FLING_START: |
463 if (touch_dragging_) { | 463 if (touch_dragging_) { |
464 SetTouchDragging(false); | 464 SetTouchDragging(false); |
465 apps_grid_view_->EndDrag(false); | 465 apps_grid_view_->EndDrag(false); |
466 event->SetHandled(); | 466 event->SetHandled(); |
467 } | 467 } |
468 break; | 468 break; |
469 case ui::ET_GESTURE_TAP_DOWN: | 469 case ui::ET_GESTURE_TAP_DOWN: |
470 if (::switches::IsTouchFeedbackEnabled() && state_ != STATE_DISABLED) { | 470 if (::switches::IsTouchFeedbackEnabled() && state() != STATE_DISABLED) { |
471 SetState(STATE_PRESSED); | 471 SetState(STATE_PRESSED); |
472 event->SetHandled(); | 472 event->SetHandled(); |
473 } | 473 } |
474 break; | 474 break; |
475 case ui::ET_GESTURE_TAP: | 475 case ui::ET_GESTURE_TAP: |
476 case ui::ET_GESTURE_TAP_CANCEL: | 476 case ui::ET_GESTURE_TAP_CANCEL: |
477 if (::switches::IsTouchFeedbackEnabled() && state_ != STATE_DISABLED) | 477 if (::switches::IsTouchFeedbackEnabled() && state() != STATE_DISABLED) |
478 SetState(STATE_NORMAL); | 478 SetState(STATE_NORMAL); |
479 break; | 479 break; |
480 case ui::ET_GESTURE_LONG_PRESS: | 480 case ui::ET_GESTURE_LONG_PRESS: |
481 if (!apps_grid_view_->has_dragged_view()) | 481 if (!apps_grid_view_->has_dragged_view()) |
482 SetTouchDragging(true); | 482 SetTouchDragging(true); |
483 event->SetHandled(); | 483 event->SetHandled(); |
484 break; | 484 break; |
485 case ui::ET_GESTURE_LONG_TAP: | 485 case ui::ET_GESTURE_LONG_TAP: |
486 case ui::ET_GESTURE_END: | 486 case ui::ET_GESTURE_END: |
487 if (touch_dragging_) | 487 if (touch_dragging_) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 SetItemPercentDownloaded(item_weak_->percent_downloaded()); | 573 SetItemPercentDownloaded(item_weak_->percent_downloaded()); |
574 } | 574 } |
575 | 575 |
576 void AppListItemView::ItemBeingDestroyed() { | 576 void AppListItemView::ItemBeingDestroyed() { |
577 DCHECK(item_weak_); | 577 DCHECK(item_weak_); |
578 item_weak_->RemoveObserver(this); | 578 item_weak_->RemoveObserver(this); |
579 item_weak_ = NULL; | 579 item_weak_ = NULL; |
580 } | 580 } |
581 | 581 |
582 } // namespace app_list | 582 } // namespace app_list |
OLD | NEW |