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