OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FOLDER_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/app_list/app_list_item_list_observer.h" | 10 #include "ui/app_list/app_list_item_list_observer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 class AppListFolderView : public views::View, | 30 class AppListFolderView : public views::View, |
31 public FolderHeaderViewDelegate, | 31 public FolderHeaderViewDelegate, |
32 public AppListModelObserver, | 32 public AppListModelObserver, |
33 public ui::ImplicitAnimationObserver, | 33 public ui::ImplicitAnimationObserver, |
34 public AppsGridViewFolderDelegate { | 34 public AppsGridViewFolderDelegate { |
35 public: | 35 public: |
36 AppListFolderView(AppsContainerView* container_view, | 36 AppListFolderView(AppsContainerView* container_view, |
37 AppListModel* model, | 37 AppListModel* model, |
38 AppListMainView* app_list_main_view); | 38 AppListMainView* app_list_main_view); |
39 virtual ~AppListFolderView(); | 39 ~AppListFolderView() override; |
40 | 40 |
41 void SetAppListFolderItem(AppListFolderItem* folder); | 41 void SetAppListFolderItem(AppListFolderItem* folder); |
42 | 42 |
43 // Schedules an animation to show or hide the view. | 43 // Schedules an animation to show or hide the view. |
44 // If |show| is false, the view should be set to invisible after the | 44 // If |show| is false, the view should be set to invisible after the |
45 // animation is done unless |hide_for_reparent| is true. | 45 // animation is done unless |hide_for_reparent| is true. |
46 void ScheduleShowHideAnimation(bool show, bool hide_for_reparent); | 46 void ScheduleShowHideAnimation(bool show, bool hide_for_reparent); |
47 | 47 |
48 // Gets icon image bounds of the item at |index|, relative to | 48 // Gets icon image bounds of the item at |index|, relative to |
49 // AppListFolderView. | 49 // AppListFolderView. |
50 gfx::Rect GetItemIconBoundsAt(int index); | 50 gfx::Rect GetItemIconBoundsAt(int index); |
51 | 51 |
52 void UpdateFolderNameVisibility(bool visible); | 52 void UpdateFolderNameVisibility(bool visible); |
53 | 53 |
54 // Hides the view immediately without animation. | 54 // Hides the view immediately without animation. |
55 void HideViewImmediately(); | 55 void HideViewImmediately(); |
56 | 56 |
57 // Closes the folder page and goes back the top level page. | 57 // Closes the folder page and goes back the top level page. |
58 void CloseFolderPage(); | 58 void CloseFolderPage(); |
59 | 59 |
60 // views::View | 60 // views::View |
61 virtual gfx::Size GetPreferredSize() const override; | 61 gfx::Size GetPreferredSize() const override; |
62 virtual void Layout() override; | 62 void Layout() override; |
63 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 63 bool OnKeyPressed(const ui::KeyEvent& event) override; |
64 | 64 |
65 // AppListModelObserver | 65 // AppListModelObserver |
66 virtual void OnAppListItemWillBeDeleted(AppListItem* item) override; | 66 void OnAppListItemWillBeDeleted(AppListItem* item) override; |
67 | 67 |
68 // ui::ImplicitAnimationObserver | 68 // ui::ImplicitAnimationObserver |
69 virtual void OnImplicitAnimationsCompleted() override; | 69 void OnImplicitAnimationsCompleted() override; |
70 | 70 |
71 AppsGridView* items_grid_view() { return items_grid_view_; } | 71 AppsGridView* items_grid_view() { return items_grid_view_; } |
72 | 72 |
73 private: | 73 private: |
74 void CalculateIdealBounds(); | 74 void CalculateIdealBounds(); |
75 | 75 |
76 // Starts setting up drag in root level apps grid view for re-parenting a | 76 // Starts setting up drag in root level apps grid view for re-parenting a |
77 // folder item. | 77 // folder item. |
78 // |drag_point_in_root_grid| is in the cooridnates of root level AppsGridView. | 78 // |drag_point_in_root_grid| is in the cooridnates of root level AppsGridView. |
79 void StartSetupDragInRootLevelAppsGridView( | 79 void StartSetupDragInRootLevelAppsGridView( |
80 AppListItemView* original_drag_view, | 80 AppListItemView* original_drag_view, |
81 const gfx::Point& drag_point_in_root_grid); | 81 const gfx::Point& drag_point_in_root_grid); |
82 | 82 |
83 // Overridden from views::View: | 83 // Overridden from views::View: |
84 virtual void GetAccessibleState(ui::AXViewState* state) override; | 84 void GetAccessibleState(ui::AXViewState* state) override; |
85 | 85 |
86 // Overridden from FolderHeaderViewDelegate: | 86 // Overridden from FolderHeaderViewDelegate: |
87 virtual void NavigateBack(AppListFolderItem* item, | 87 void NavigateBack(AppListFolderItem* item, |
88 const ui::Event& event_flags) override; | 88 const ui::Event& event_flags) override; |
89 virtual void GiveBackFocusToSearchBox() override; | 89 void GiveBackFocusToSearchBox() override; |
90 virtual void SetItemName(AppListFolderItem* item, | 90 void SetItemName(AppListFolderItem* item, const std::string& name) override; |
91 const std::string& name) override; | |
92 | 91 |
93 // Overridden from AppsGridViewFolderDelegate: | 92 // Overridden from AppsGridViewFolderDelegate: |
94 virtual void UpdateFolderViewBackground(bool show_bubble) override; | 93 void UpdateFolderViewBackground(bool show_bubble) override; |
95 virtual void ReparentItem(AppListItemView* original_drag_view, | 94 void ReparentItem(AppListItemView* original_drag_view, |
96 const gfx::Point& drag_point_in_folder_grid) | 95 const gfx::Point& drag_point_in_folder_grid) override; |
97 override; | 96 void DispatchDragEventForReparent( |
98 virtual void DispatchDragEventForReparent( | |
99 AppsGridView::Pointer pointer, | 97 AppsGridView::Pointer pointer, |
100 const gfx::Point& drag_point_in_folder_grid) override; | 98 const gfx::Point& drag_point_in_folder_grid) override; |
101 virtual void DispatchEndDragEventForReparent( | 99 void DispatchEndDragEventForReparent(bool events_forwarded_to_drag_drop_host, |
102 bool events_forwarded_to_drag_drop_host, | 100 bool cancel_drag) override; |
103 bool cancel_drag) override; | 101 bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) override; |
104 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) override; | 102 bool IsOEMFolder() const override; |
105 virtual bool IsOEMFolder() const override; | 103 void SetRootLevelDragViewVisible(bool visible) override; |
106 virtual void SetRootLevelDragViewVisible(bool visible) override; | |
107 | 104 |
108 AppsContainerView* container_view_; // Not owned. | 105 AppsContainerView* container_view_; // Not owned. |
109 AppListMainView* app_list_main_view_; // Not Owned. | 106 AppListMainView* app_list_main_view_; // Not Owned. |
110 FolderHeaderView* folder_header_view_; // Owned by views hierarchy. | 107 FolderHeaderView* folder_header_view_; // Owned by views hierarchy. |
111 AppsGridView* items_grid_view_; // Owned by the views hierarchy. | 108 AppsGridView* items_grid_view_; // Owned by the views hierarchy. |
112 | 109 |
113 scoped_ptr<views::ViewModel> view_model_; | 110 scoped_ptr<views::ViewModel> view_model_; |
114 | 111 |
115 AppListModel* model_; // Not owned. | 112 AppListModel* model_; // Not owned. |
116 AppListFolderItem* folder_item_; // Not owned. | 113 AppListFolderItem* folder_item_; // Not owned. |
117 | 114 |
118 bool hide_for_reparent_; | 115 bool hide_for_reparent_; |
119 | 116 |
120 base::string16 accessible_name_; | 117 base::string16 accessible_name_; |
121 | 118 |
122 DISALLOW_COPY_AND_ASSIGN(AppListFolderView); | 119 DISALLOW_COPY_AND_ASSIGN(AppListFolderView); |
123 }; | 120 }; |
124 | 121 |
125 } // namespace app_list | 122 } // namespace app_list |
126 | 123 |
127 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ | 124 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ |
OLD | NEW |