| 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 #ifndef UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/timer.h" | 12 #include "base/timer.h" |
| 13 #include "ui/app_list/app_list_export.h" | 13 #include "ui/app_list/app_list_export.h" |
| 14 #include "ui/app_list/app_list_item_model_observer.h" | 14 #include "ui/app_list/app_list_item_model_observer.h" |
| 15 #include "ui/app_list/views/cached_label.h" |
| 15 #include "ui/gfx/shadow_value.h" | 16 #include "ui/gfx/shadow_value.h" |
| 16 #include "ui/views/context_menu_controller.h" | 17 #include "ui/views/context_menu_controller.h" |
| 17 #include "ui/views/controls/button/custom_button.h" | 18 #include "ui/views/controls/button/custom_button.h" |
| 18 | 19 |
| 19 class SkBitmap; | 20 class SkBitmap; |
| 20 | 21 |
| 21 namespace views { | 22 namespace views { |
| 22 class ImageView; | 23 class ImageView; |
| 23 class Label; | 24 class Label; |
| 24 class MenuRunner; | 25 class MenuRunner; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace app_list { | 28 namespace app_list { |
| 28 | 29 |
| 29 class AppListItemModel; | 30 class AppListItemModel; |
| 30 class AppsGridView; | 31 class AppsGridView; |
| 31 class CachedLabel; | |
| 32 | 32 |
| 33 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, | 33 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, |
| 34 public views::ContextMenuController, | 34 public views::ContextMenuController, |
| 35 public AppListItemModelObserver { | 35 public AppListItemModelObserver { |
| 36 public: | 36 public: |
| 37 // Internal class name. | 37 // Internal class name. |
| 38 static const char kViewClassName[]; | 38 static const char kViewClassName[]; |
| 39 | 39 |
| 40 AppListItemView(AppsGridView* apps_grid_view, AppListItemModel* model); | 40 AppListItemView(AppsGridView* apps_grid_view, AppListItemModel* model); |
| 41 virtual ~AppListItemView(); | 41 virtual ~AppListItemView(); |
| 42 | 42 |
| 43 void SetIconSize(const gfx::Size& size); | 43 void SetIconSize(const gfx::Size& size); |
| 44 | 44 |
| 45 void Prerender(); | 45 void Prerender(); |
| 46 | 46 |
| 47 AppListItemModel* model() const { return model_; } | 47 AppListItemModel* model() const { return model_; } |
| 48 | 48 |
| 49 const views::Label* title() const { return title_; } |
| 50 |
| 49 private: | 51 private: |
| 50 enum UIState { | 52 enum UIState { |
| 51 UI_STATE_NORMAL, // Normal UI (icon + label) | 53 UI_STATE_NORMAL, // Normal UI (icon + label) |
| 52 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) | 54 UI_STATE_DRAGGING, // Dragging UI (scaled icon only) |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 // Get icon from model and schedule background processing. | 57 // Get icon from model and schedule background processing. |
| 56 void UpdateIcon(); | 58 void UpdateIcon(); |
| 57 | 59 |
| 58 void SetUIState(UIState state); | 60 void SetUIState(UIState state); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 114 |
| 113 // A timer to defer showing drag UI when mouse is pressed. | 115 // A timer to defer showing drag UI when mouse is pressed. |
| 114 base::OneShotTimer<AppListItemView> mouse_drag_timer_; | 116 base::OneShotTimer<AppListItemView> mouse_drag_timer_; |
| 115 | 117 |
| 116 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 118 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
| 117 }; | 119 }; |
| 118 | 120 |
| 119 } // namespace app_list | 121 } // namespace app_list |
| 120 | 122 |
| 121 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 123 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| OLD | NEW |