| 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" |
| 11 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_view_state.h" |
| 12 #include "ui/app_list/app_list_constants.h" | 12 #include "ui/app_list/app_list_constants.h" |
| 13 #include "ui/app_list/app_list_folder_item.h" | 13 #include "ui/app_list/app_list_folder_item.h" |
| 14 #include "ui/app_list/app_list_item.h" | 14 #include "ui/app_list/app_list_item.h" |
| 15 #include "ui/app_list/app_list_switches.h" | 15 #include "ui/app_list/app_list_switches.h" |
| 16 #include "ui/app_list/views/apps_grid_view.h" | 16 #include "ui/app_list/views/apps_grid_view.h" |
| 17 #include "ui/app_list/views/progress_bar_view.h" | |
| 18 #include "ui/base/dragdrop/drag_utils.h" | 17 #include "ui/base/dragdrop/drag_utils.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/scoped_layer_animation_settings.h" | 21 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 23 #include "ui/gfx/animation/throb_animation.h" | 22 #include "ui/gfx/animation/throb_animation.h" |
| 24 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/font_list.h" | 24 #include "ui/gfx/font_list.h" |
| 26 #include "ui/gfx/geometry/point.h" | 25 #include "ui/gfx/geometry/point.h" |
| 27 #include "ui/gfx/geometry/vector2d.h" | 26 #include "ui/gfx/geometry/vector2d.h" |
| 28 #include "ui/gfx/image/image_skia_operations.h" | 27 #include "ui/gfx/image/image_skia_operations.h" |
| 29 #include "ui/gfx/shadow_value.h" | 28 #include "ui/gfx/shadow_value.h" |
| 30 #include "ui/gfx/transform_util.h" | 29 #include "ui/gfx/transform_util.h" |
| 31 #include "ui/strings/grit/ui_strings.h" | 30 #include "ui/strings/grit/ui_strings.h" |
| 32 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
| 33 #include "ui/views/controls/image_view.h" | 32 #include "ui/views/controls/image_view.h" |
| 34 #include "ui/views/controls/label.h" | 33 #include "ui/views/controls/label.h" |
| 35 #include "ui/views/controls/menu/menu_runner.h" | 34 #include "ui/views/controls/menu/menu_runner.h" |
| 35 #include "ui/views/controls/progress_bar.h" |
| 36 #include "ui/views/drag_controller.h" | 36 #include "ui/views/drag_controller.h" |
| 37 | 37 |
| 38 namespace app_list { | 38 namespace app_list { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const int kTopPadding = 18; | 42 const int kTopPadding = 18; |
| 43 const int kIconTitleSpacing = 6; | 43 const int kIconTitleSpacing = 6; |
| 44 | 44 |
| 45 // Radius of the folder dropping preview circle. | 45 // Radius of the folder dropping preview circle. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 AppListItemView::AppListItemView(AppsGridView* apps_grid_view, | 72 AppListItemView::AppListItemView(AppsGridView* apps_grid_view, |
| 73 AppListItem* item) | 73 AppListItem* item) |
| 74 : CustomButton(apps_grid_view), | 74 : CustomButton(apps_grid_view), |
| 75 is_folder_(item->GetItemType() == AppListFolderItem::kItemType), | 75 is_folder_(item->GetItemType() == AppListFolderItem::kItemType), |
| 76 is_in_folder_(item->IsInFolder()), | 76 is_in_folder_(item->IsInFolder()), |
| 77 item_weak_(item), | 77 item_weak_(item), |
| 78 apps_grid_view_(apps_grid_view), | 78 apps_grid_view_(apps_grid_view), |
| 79 icon_(new views::ImageView), | 79 icon_(new views::ImageView), |
| 80 title_(new views::Label), | 80 title_(new views::Label), |
| 81 progress_bar_(new ProgressBarView), | 81 progress_bar_(new views::ProgressBar), |
| 82 ui_state_(UI_STATE_NORMAL), | 82 ui_state_(UI_STATE_NORMAL), |
| 83 touch_dragging_(false), | 83 touch_dragging_(false), |
| 84 shadow_animator_(this), | 84 shadow_animator_(this), |
| 85 is_installing_(false), | 85 is_installing_(false), |
| 86 is_highlighted_(false) { | 86 is_highlighted_(false) { |
| 87 shadow_animator_.animation()->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | 87 shadow_animator_.animation()->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); |
| 88 shadow_animator_.SetStartAndEndShadows(IconStartShadows(), IconEndShadows()); | 88 shadow_animator_.SetStartAndEndShadows(IconStartShadows(), IconEndShadows()); |
| 89 | 89 |
| 90 icon_->set_interactive(false); | 90 icon_->set_interactive(false); |
| 91 icon_->SetVerticalAlignment(views::ImageView::LEADING); | 91 icon_->SetVerticalAlignment(views::ImageView::LEADING); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 SetItemPercentDownloaded(item_weak_->percent_downloaded()); | 526 SetItemPercentDownloaded(item_weak_->percent_downloaded()); |
| 527 } | 527 } |
| 528 | 528 |
| 529 void AppListItemView::ItemBeingDestroyed() { | 529 void AppListItemView::ItemBeingDestroyed() { |
| 530 DCHECK(item_weak_); | 530 DCHECK(item_weak_); |
| 531 item_weak_->RemoveObserver(this); | 531 item_weak_->RemoveObserver(this); |
| 532 item_weak_ = NULL; | 532 item_weak_ = NULL; |
| 533 } | 533 } |
| 534 | 534 |
| 535 } // namespace app_list | 535 } // namespace app_list |
| OLD | NEW |