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/timer.h" | 12 #include "base/timer/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_observer.h" | 14 #include "ui/app_list/app_list_item_observer.h" |
15 #include "ui/app_list/views/cached_label.h" | 15 #include "ui/app_list/views/cached_label.h" |
16 #include "ui/gfx/shadow_value.h" | |
17 #include "ui/views/context_menu_controller.h" | 16 #include "ui/views/context_menu_controller.h" |
18 #include "ui/views/controls/button/custom_button.h" | 17 #include "ui/views/controls/button/custom_button.h" |
19 | 18 |
20 class SkBitmap; | 19 class SkBitmap; |
21 | 20 |
22 namespace views { | 21 namespace views { |
23 class ImageView; | 22 class ImageView; |
24 class Label; | 23 class Label; |
25 class MenuRunner; | 24 class MenuRunner; |
26 } | 25 } |
27 | 26 |
28 namespace app_list { | 27 namespace app_list { |
29 | 28 |
30 class AppListItem; | 29 class AppListItem; |
31 class AppsGridView; | 30 class AppsGridView; |
32 class ProgressBarView; | 31 class ProgressBarView; |
33 | 32 |
34 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, | 33 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, |
35 public views::ContextMenuController, | 34 public views::ContextMenuController, |
36 public AppListItemObserver { | 35 public AppListItemObserver { |
37 public: | 36 public: |
38 // Internal class name. | 37 // Internal class name. |
39 static const char kViewClassName[]; | 38 static const char kViewClassName[]; |
40 | 39 |
41 AppListItemView(AppsGridView* apps_grid_view, AppListItem* item); | 40 AppListItemView(AppsGridView* apps_grid_view, AppListItem* item); |
42 virtual ~AppListItemView(); | 41 virtual ~AppListItemView(); |
43 | 42 |
44 void SetIconSize(const gfx::Size& size); | |
45 | |
46 void Prerender(); | 43 void Prerender(); |
47 | 44 |
48 void CancelContextMenu(); | 45 void CancelContextMenu(); |
49 | 46 |
50 gfx::ImageSkia GetDragImage(); | 47 gfx::ImageSkia GetDragImage(); |
51 void OnDragEnded(); | 48 void OnDragEnded(); |
52 gfx::Point GetDragImageOffset(); | 49 gfx::Point GetDragImageOffset(); |
53 | 50 |
54 void SetAsAttemptedFolderTarget(bool is_target_folder); | 51 void SetAsAttemptedFolderTarget(bool is_target_folder); |
55 | 52 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 129 |
133 AppListItem* item_; // Owned by AppListModel. | 130 AppListItem* item_; // Owned by AppListModel. |
134 | 131 |
135 AppsGridView* apps_grid_view_; // Owned by views hierarchy. | 132 AppsGridView* apps_grid_view_; // Owned by views hierarchy. |
136 views::ImageView* icon_; // Owned by views hierarchy. | 133 views::ImageView* icon_; // Owned by views hierarchy. |
137 CachedLabel* title_; // Owned by views hierarchy. | 134 CachedLabel* title_; // Owned by views hierarchy. |
138 ProgressBarView* progress_bar_; // Owned by views hierarchy. | 135 ProgressBarView* progress_bar_; // Owned by views hierarchy. |
139 | 136 |
140 scoped_ptr<views::MenuRunner> context_menu_runner_; | 137 scoped_ptr<views::MenuRunner> context_menu_runner_; |
141 | 138 |
142 gfx::Size icon_size_; | |
143 gfx::ShadowValues icon_shadows_; | |
144 | |
145 UIState ui_state_; | 139 UIState ui_state_; |
146 | 140 |
147 // True if scroll gestures should contribute to dragging. | 141 // True if scroll gestures should contribute to dragging. |
148 bool touch_dragging_; | 142 bool touch_dragging_; |
149 | 143 |
150 // A timer to defer showing drag UI when mouse is pressed. | 144 // A timer to defer showing drag UI when mouse is pressed. |
151 base::OneShotTimer<AppListItemView> mouse_drag_timer_; | 145 base::OneShotTimer<AppListItemView> mouse_drag_timer_; |
152 | 146 |
153 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 147 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
154 }; | 148 }; |
155 | 149 |
156 } // namespace app_list | 150 } // namespace app_list |
157 | 151 |
158 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 152 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
OLD | NEW |