| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class ProgressBarView; | 32 class ProgressBarView; |
| 33 | 33 |
| 34 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, | 34 class APP_LIST_EXPORT AppListItemView : public views::CustomButton, |
| 35 public views::ContextMenuController, | 35 public views::ContextMenuController, |
| 36 public AppListItemObserver { | 36 public AppListItemObserver { |
| 37 public: | 37 public: |
| 38 // Internal class name. | 38 // Internal class name. |
| 39 static const char kViewClassName[]; | 39 static const char kViewClassName[]; |
| 40 | 40 |
| 41 AppListItemView(AppsGridView* apps_grid_view, AppListItem* item); | 41 AppListItemView(AppsGridView* apps_grid_view, AppListItem* item); |
| 42 virtual ~AppListItemView(); | 42 ~AppListItemView() override; |
| 43 | 43 |
| 44 // Set the icon of this image, adding a drop shadow if |has_shadow|. | 44 // Set the icon of this image, adding a drop shadow if |has_shadow|. |
| 45 void SetIcon(const gfx::ImageSkia& icon, bool has_shadow); | 45 void SetIcon(const gfx::ImageSkia& icon, bool has_shadow); |
| 46 | 46 |
| 47 // Set the item name. | 47 // Set the item name. |
| 48 void SetItemName(const base::string16& display_name, | 48 void SetItemName(const base::string16& display_name, |
| 49 const base::string16& full_name); | 49 const base::string16& full_name); |
| 50 void SetItemIsInstalling(bool is_installing); | 50 void SetItemIsInstalling(bool is_installing); |
| 51 void SetItemIsHighlighted(bool is_highlighted); | 51 void SetItemIsHighlighted(bool is_highlighted); |
| 52 void SetItemPercentDownloaded(int percent_downloaded); | 52 void SetItemPercentDownloaded(int percent_downloaded); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void SetTouchDragging(bool touch_dragging); | 100 void SetTouchDragging(bool touch_dragging); |
| 101 | 101 |
| 102 // Invoked when |mouse_drag_timer_| fires to show dragging UI. | 102 // Invoked when |mouse_drag_timer_| fires to show dragging UI. |
| 103 void OnMouseDragTimer(); | 103 void OnMouseDragTimer(); |
| 104 | 104 |
| 105 // If the item is not in a folder, not highlighted, not being dragged, and not | 105 // If the item is not in a folder, not highlighted, not being dragged, and not |
| 106 // having something dropped onto it, enables subpixel AA for the title. | 106 // having something dropped onto it, enables subpixel AA for the title. |
| 107 void SetTitleSubpixelAA(); | 107 void SetTitleSubpixelAA(); |
| 108 | 108 |
| 109 // views::View overrides: | 109 // views::View overrides: |
| 110 virtual const char* GetClassName() const override; | 110 const char* GetClassName() const override; |
| 111 virtual void Layout() override; | 111 void Layout() override; |
| 112 virtual void SchedulePaintInRect(const gfx::Rect& r) override; | 112 void SchedulePaintInRect(const gfx::Rect& r) override; |
| 113 virtual void OnPaint(gfx::Canvas* canvas) override; | 113 void OnPaint(gfx::Canvas* canvas) override; |
| 114 | 114 |
| 115 // views::ContextMenuController overrides: | 115 // views::ContextMenuController overrides: |
| 116 virtual void ShowContextMenuForView(views::View* source, | 116 void ShowContextMenuForView(views::View* source, |
| 117 const gfx::Point& point, | 117 const gfx::Point& point, |
| 118 ui::MenuSourceType source_type) override; | 118 ui::MenuSourceType source_type) override; |
| 119 | 119 |
| 120 // views::CustomButton overrides: | 120 // views::CustomButton overrides: |
| 121 virtual void StateChanged() override; | 121 void StateChanged() override; |
| 122 virtual bool ShouldEnterPushedState(const ui::Event& event) override; | 122 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 123 | 123 |
| 124 // views::View overrides: | 124 // views::View overrides: |
| 125 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 125 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 126 virtual bool OnMousePressed(const ui::MouseEvent& event) override; | 126 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 127 virtual void OnMouseReleased(const ui::MouseEvent& event) override; | 127 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 128 virtual void OnMouseCaptureLost() override; | 128 void OnMouseCaptureLost() override; |
| 129 virtual bool OnMouseDragged(const ui::MouseEvent& event) override; | 129 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 130 | 130 |
| 131 // ui::EventHandler overrides: | 131 // ui::EventHandler overrides: |
| 132 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 132 void OnGestureEvent(ui::GestureEvent* event) override; |
| 133 | 133 |
| 134 // AppListItemObserver overrides: | 134 // AppListItemObserver overrides: |
| 135 virtual void ItemIconChanged() override; | 135 void ItemIconChanged() override; |
| 136 virtual void ItemNameChanged() override; | 136 void ItemNameChanged() override; |
| 137 virtual void ItemIsInstallingChanged() override; | 137 void ItemIsInstallingChanged() override; |
| 138 virtual void ItemPercentDownloadedChanged() override; | 138 void ItemPercentDownloadedChanged() override; |
| 139 virtual void ItemBeingDestroyed() override; | 139 void ItemBeingDestroyed() override; |
| 140 | 140 |
| 141 const bool is_folder_; | 141 const bool is_folder_; |
| 142 const bool is_in_folder_; | 142 const bool is_in_folder_; |
| 143 | 143 |
| 144 AppListItem* item_weak_; // Owned by AppListModel. Can be NULL. | 144 AppListItem* item_weak_; // Owned by AppListModel. Can be NULL. |
| 145 | 145 |
| 146 AppsGridView* apps_grid_view_; // Parent view, owns this. | 146 AppsGridView* apps_grid_view_; // Parent view, owns this. |
| 147 views::ImageView* icon_; // Strongly typed child view. | 147 views::ImageView* icon_; // Strongly typed child view. |
| 148 CachedLabel* title_; // Strongly typed child view. | 148 CachedLabel* title_; // Strongly typed child view. |
| 149 ProgressBarView* progress_bar_; // Strongly typed child view. | 149 ProgressBarView* progress_bar_; // Strongly typed child view. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 160 | 160 |
| 161 // A timer to defer showing drag UI when mouse is pressed. | 161 // A timer to defer showing drag UI when mouse is pressed. |
| 162 base::OneShotTimer<AppListItemView> mouse_drag_timer_; | 162 base::OneShotTimer<AppListItemView> mouse_drag_timer_; |
| 163 | 163 |
| 164 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 164 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace app_list | 167 } // namespace app_list |
| 168 | 168 |
| 169 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ | 169 #endif // UI_APP_LIST_VIEWS_APP_LIST_ITEM_VIEW_H_ |
| OLD | NEW |