| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "ui/app_list/app_list_export.h" | 15 #include "ui/app_list/app_list_export.h" |
| 16 #include "ui/app_list/app_list_item_observer.h" | 16 #include "ui/app_list/app_list_item_observer.h" |
| 17 #include "ui/app_list/views/cached_label.h" | |
| 18 #include "ui/app_list/views/image_shadow_animator.h" | 17 #include "ui/app_list/views/image_shadow_animator.h" |
| 19 #include "ui/views/context_menu_controller.h" | 18 #include "ui/views/context_menu_controller.h" |
| 20 #include "ui/views/controls/button/custom_button.h" | 19 #include "ui/views/controls/button/custom_button.h" |
| 21 | 20 |
| 22 class SkBitmap; | 21 class SkBitmap; |
| 23 | 22 |
| 24 namespace views { | 23 namespace views { |
| 25 class ImageView; | 24 class ImageView; |
| 26 class Label; | 25 class Label; |
| 27 class MenuRunner; | 26 class MenuRunner; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 47 // Set the icon of this image, adding a drop shadow if |has_shadow|. | 46 // Set the icon of this image, adding a drop shadow if |has_shadow|. |
| 48 void SetIcon(const gfx::ImageSkia& icon); | 47 void SetIcon(const gfx::ImageSkia& icon); |
| 49 | 48 |
| 50 void SetItemName(const base::string16& display_name, | 49 void SetItemName(const base::string16& display_name, |
| 51 const base::string16& full_name); | 50 const base::string16& full_name); |
| 52 void SetItemIsInstalling(bool is_installing); | 51 void SetItemIsInstalling(bool is_installing); |
| 53 bool is_highlighted() { return is_highlighted_; } // for unit test | 52 bool is_highlighted() { return is_highlighted_; } // for unit test |
| 54 void SetItemIsHighlighted(bool is_highlighted); | 53 void SetItemIsHighlighted(bool is_highlighted); |
| 55 void SetItemPercentDownloaded(int percent_downloaded); | 54 void SetItemPercentDownloaded(int percent_downloaded); |
| 56 | 55 |
| 57 void Prerender(); | |
| 58 | |
| 59 void CancelContextMenu(); | 56 void CancelContextMenu(); |
| 60 | 57 |
| 61 gfx::ImageSkia GetDragImage(); | 58 gfx::ImageSkia GetDragImage(); |
| 62 void OnDragEnded(); | 59 void OnDragEnded(); |
| 63 gfx::Point GetDragImageOffset(); | 60 gfx::Point GetDragImageOffset(); |
| 64 | 61 |
| 65 void SetAsAttemptedFolderTarget(bool is_target_folder); | 62 void SetAsAttemptedFolderTarget(bool is_target_folder); |
| 66 | 63 |
| 67 AppListItem* item() const { return item_weak_; } | 64 AppListItem* item() const { return item_weak_; } |
| 68 | 65 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ui::MenuSourceType source_type) override; | 127 ui::MenuSourceType source_type) override; |
| 131 | 128 |
| 132 // views::CustomButton overrides: | 129 // views::CustomButton overrides: |
| 133 void StateChanged() override; | 130 void StateChanged() override; |
| 134 bool ShouldEnterPushedState(const ui::Event& event) override; | 131 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 135 | 132 |
| 136 // views::View overrides: | 133 // views::View overrides: |
| 137 bool OnKeyPressed(const ui::KeyEvent& event) override; | 134 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 138 bool OnMousePressed(const ui::MouseEvent& event) override; | 135 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 139 void OnMouseReleased(const ui::MouseEvent& event) override; | 136 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 140 void OnMouseCaptureLost() override; | |
| 141 bool OnMouseDragged(const ui::MouseEvent& event) override; | 137 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 142 | 138 |
| 143 // AppListItemObserver overrides: | 139 // AppListItemObserver overrides: |
| 144 void ItemIconChanged() override; | 140 void ItemIconChanged() override; |
| 145 void ItemNameChanged() override; | 141 void ItemNameChanged() override; |
| 146 void ItemIsInstallingChanged() override; | 142 void ItemIsInstallingChanged() override; |
| 147 void ItemPercentDownloadedChanged() override; | 143 void ItemPercentDownloadedChanged() override; |
| 148 void ItemBeingDestroyed() override; | 144 void ItemBeingDestroyed() override; |
| 149 | 145 |
| 150 const bool is_folder_; | 146 const bool is_folder_; |
| 151 const bool is_in_folder_; | 147 const bool is_in_folder_; |
| 152 | 148 |
| 153 AppListItem* item_weak_; // Owned by AppListModel. Can be NULL. | 149 AppListItem* item_weak_; // Owned by AppListModel. Can be NULL. |
| 154 | 150 |
| 155 AppsGridView* apps_grid_view_; // Parent view, owns this. | 151 AppsGridView* apps_grid_view_; // Parent view, owns this. |
| 156 views::ImageView* icon_; // Strongly typed child view. | 152 views::ImageView* icon_; // Strongly typed child view. |
| 157 CachedLabel* title_; // Strongly typed child view. | 153 views::Label* title_; // Strongly typed child view. |
| 158 ProgressBarView* progress_bar_; // Strongly typed child view. | 154 ProgressBarView* progress_bar_; // Strongly typed child view. |
| 159 | 155 |
| 160 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 156 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
| 161 | 157 |
| 162 UIState ui_state_; | 158 UIState ui_state_; |
| 163 | 159 |
| 164 // True if scroll gestures should contribute to dragging. | 160 // True if scroll gestures should contribute to dragging. |
| 165 bool touch_dragging_; | 161 bool touch_dragging_; |
| 166 | 162 |
| 167 ImageShadowAnimator shadow_animator_; | 163 ImageShadowAnimator shadow_animator_; |
| 168 | 164 |
| 169 bool is_installing_; | 165 bool is_installing_; |
| 170 bool is_highlighted_; | 166 bool is_highlighted_; |
| 171 | 167 |
| 172 base::string16 tooltip_text_; | 168 base::string16 tooltip_text_; |
| 173 | 169 |
| 174 // A timer to defer showing drag UI when mouse is pressed. | 170 // A timer to defer showing drag UI when mouse is pressed. |
| 175 base::OneShotTimer mouse_drag_timer_; | 171 base::OneShotTimer mouse_drag_timer_; |
| 176 | 172 |
| 177 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 173 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
| 178 }; | 174 }; |
| 179 | 175 |
| 180 } // namespace app_list | 176 } // namespace app_list |
| 181 | 177 |
| 182 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 178 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| OLD | NEW |