Chromium Code Reviews| 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 "ui/app_list/app_list_item_list_observer.h" | 8 #include "ui/app_list/app_list_item_list_observer.h" |
| 9 #include "ui/app_list/views/apps_grid_view.h" | 9 #include "ui/app_list/views/apps_grid_view.h" |
| 10 #include "ui/app_list/views/apps_grid_view_folder_delegate.h" | |
| 10 #include "ui/app_list/views/folder_header_view.h" | 11 #include "ui/app_list/views/folder_header_view.h" |
| 11 #include "ui/app_list/views/folder_header_view_delegate.h" | 12 #include "ui/app_list/views/folder_header_view_delegate.h" |
| 12 #include "ui/compositor/layer_animation_observer.h" | 13 #include "ui/compositor/layer_animation_observer.h" |
| 13 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class WebContents; | 18 class WebContents; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 class ViewModel; | 22 class ViewModel; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace app_list { | 25 namespace app_list { |
| 25 | 26 |
| 26 class AppsContainerView; | 27 class AppsContainerView; |
| 27 class AppsGridView; | 28 class AppsGridView; |
| 28 class AppListFolderItem; | 29 class AppListFolderItem; |
| 29 class AppListItemView; | 30 class AppListItemView; |
| 30 class AppListMainView; | 31 class AppListMainView; |
| 31 class AppListModel; | 32 class AppListModel; |
| 32 class FolderHeaderView; | 33 class FolderHeaderView; |
| 33 class PaginationModel; | 34 class PaginationModel; |
| 34 | 35 |
| 35 class AppListFolderView : public views::View, | 36 class AppListFolderView : public views::View, |
| 36 public FolderHeaderViewDelegate, | 37 public FolderHeaderViewDelegate, |
| 37 public AppListItemListObserver, | 38 public AppListItemListObserver, |
| 38 public ui::ImplicitAnimationObserver { | 39 public ui::ImplicitAnimationObserver, |
| 40 public AppsGridViewFolderDelegate { | |
| 39 public: | 41 public: |
| 40 AppListFolderView(AppsContainerView* container_view, | 42 AppListFolderView(AppsContainerView* container_view, |
| 41 AppListModel* model, | 43 AppListModel* model, |
| 42 AppListMainView* app_list_main_view, | 44 AppListMainView* app_list_main_view, |
| 43 content::WebContents* start_page_contents); | 45 content::WebContents* start_page_contents); |
| 44 virtual ~AppListFolderView(); | 46 virtual ~AppListFolderView(); |
| 45 | 47 |
| 46 void SetAppListFolderItem(AppListFolderItem* folder); | 48 void SetAppListFolderItem(AppListFolderItem* folder); |
| 47 | 49 |
| 48 // Schedules an animation to show or hide the view. | 50 // Schedules an animation to show or hide the view. |
| 49 // If |show| is false, the view should be set to invisible after the | 51 // If |show| is false, the view should be set to invisible after the |
| 50 // animation is done unless |hide_for_reparent| is true. | 52 // animation is done unless |hide_for_reparent| is true. |
| 51 void ScheduleShowHideAnimation(bool show, bool hide_for_reparent); | 53 void ScheduleShowHideAnimation(bool show, bool hide_for_reparent); |
| 52 | 54 |
| 53 // Gets icon image bounds of the item at |index|, relative to | 55 // Gets icon image bounds of the item at |index|, relative to |
| 54 // AppListFolderView. | 56 // AppListFolderView. |
| 55 gfx::Rect GetItemIconBoundsAt(int index); | 57 gfx::Rect GetItemIconBoundsAt(int index); |
| 56 | 58 |
| 57 // Updates the folder view background to show or hide folder container ink | |
| 58 // bubble. | |
| 59 void UpdateFolderViewBackground(bool show_bubble); | |
| 60 | |
| 61 void UpdateFolderNameVisibility(bool visible); | 59 void UpdateFolderNameVisibility(bool visible); |
| 62 | 60 |
| 63 // Returns true if |point| falls outside of the folder container ink bubble. | |
| 64 bool IsPointOutsideOfFolderBoundray(const gfx::Point& point); | |
| 65 | |
| 66 // Called when a folder item is dragged out of the folder to be re-parented. | |
| 67 // |original_drag_view| is the |drag_view_| inside the folder's grid view. | |
| 68 // |drag_point_in_folder_grid| is the last drag point in coordinate of the | |
| 69 // AppsGridView inside the folder. | |
| 70 void ReparentItem(AppListItemView* original_drag_view, | |
| 71 const gfx::Point& drag_point_in_folder_grid); | |
| 72 | |
| 73 // Dispatches drag event from the hidden grid view to the root level grid view | |
| 74 // for re-parenting a folder item. | |
| 75 void DispatchDragEventForReparent(AppsGridView::Pointer pointer, | |
| 76 const ui::LocatedEvent& event); | |
| 77 | |
| 78 // Dispatches EndDrag event from the hidden grid view to the root level grid | |
| 79 // view for reparenting a folder item. | |
| 80 // |events_forwarded_to_drag_drop_host|: True if the dragged item is dropped | |
| 81 // to the drag_drop_host, eg. dropped on shelf. | |
| 82 void DispatchEndDragEventForReparent(bool events_forwarded_to_drag_drop_host); | |
| 83 | |
| 84 // Hides the view immediately without animation. | 61 // Hides the view immediately without animation. |
| 85 void HideViewImmediately(); | 62 void HideViewImmediately(); |
| 86 | 63 |
| 87 // views::View overrides: | 64 // views::View overrides: |
| 88 virtual gfx::Size GetPreferredSize() OVERRIDE; | 65 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 89 virtual void Layout() OVERRIDE; | 66 virtual void Layout() OVERRIDE; |
| 90 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 67 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 91 | 68 |
| 92 // Overridden from AppListItemListObserver: | 69 // Overridden from AppListItemListObserver: |
| 93 virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE; | 70 virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 107 AppListItemView* original_drag_view, | 84 AppListItemView* original_drag_view, |
| 108 const gfx::Point& drag_point_in_root_grid); | 85 const gfx::Point& drag_point_in_root_grid); |
| 109 | 86 |
| 110 // Overridden from FolderHeaderViewDelegate: | 87 // Overridden from FolderHeaderViewDelegate: |
| 111 virtual void NavigateBack(AppListFolderItem* item, | 88 virtual void NavigateBack(AppListFolderItem* item, |
| 112 const ui::Event& event_flags) OVERRIDE; | 89 const ui::Event& event_flags) OVERRIDE; |
| 113 virtual void GiveBackFocusToSearchBox() OVERRIDE; | 90 virtual void GiveBackFocusToSearchBox() OVERRIDE; |
| 114 virtual void SetItemName(AppListFolderItem* item, | 91 virtual void SetItemName(AppListFolderItem* item, |
| 115 const std::string& name) OVERRIDE; | 92 const std::string& name) OVERRIDE; |
| 116 | 93 |
| 94 // Overridden from AppsGridViewFolderDelegate: | |
| 95 virtual void UpdateFolderViewBackground(bool show_bubble) OVERRIDE; | |
| 96 virtual void ReparentItem(AppListItemView* original_drag_view, | |
| 97 const gfx::Point& drag_point_in_folder_grid) | |
| 98 OVERRIDE; | |
|
tapted
2014/03/26 02:53:54
nit: I think "OVERRIDE" isn't meant to appear on a
jennyz
2014/03/26 22:09:38
+1, having OVERRIDE on a separate line looks a lit
calamity
2014/03/27 05:14:44
clang-format =(
| |
| 99 virtual void DispatchDragEventForReparent(AppsGridView::Pointer pointer, | |
| 100 const ui::LocatedEvent& event) | |
| 101 OVERRIDE; | |
| 102 virtual void DispatchEndDragEventForReparent( | |
| 103 bool events_forwarded_to_drag_drop_host) OVERRIDE; | |
| 104 virtual bool IsPointOutsideOfFolderBoundary(const gfx::Point& point) OVERRIDE; | |
| 105 | |
| 117 AppsContainerView* container_view_; // Not owned. | 106 AppsContainerView* container_view_; // Not owned. |
| 118 AppListMainView* app_list_main_view_; // Not Owned. | 107 AppListMainView* app_list_main_view_; // Not Owned. |
| 119 FolderHeaderView* folder_header_view_; // Owned by views hierarchy. | 108 FolderHeaderView* folder_header_view_; // Owned by views hierarchy. |
| 120 AppsGridView* items_grid_view_; // Owned by the views hierarchy. | 109 AppsGridView* items_grid_view_; // Owned by the views hierarchy. |
| 121 | 110 |
| 122 scoped_ptr<views::ViewModel> view_model_; | 111 scoped_ptr<views::ViewModel> view_model_; |
| 123 | 112 |
| 124 AppListModel* model_; // Not owned. | 113 AppListModel* model_; // Not owned. |
| 125 AppListFolderItem* folder_item_; // Not owned. | 114 AppListFolderItem* folder_item_; // Not owned. |
| 126 | 115 |
| 127 scoped_ptr<PaginationModel> pagination_model_; | 116 scoped_ptr<PaginationModel> pagination_model_; |
| 128 | 117 |
| 129 bool hide_for_reparent_; | 118 bool hide_for_reparent_; |
| 130 | 119 |
| 131 DISALLOW_COPY_AND_ASSIGN(AppListFolderView); | 120 DISALLOW_COPY_AND_ASSIGN(AppListFolderView); |
| 132 }; | 121 }; |
| 133 | 122 |
| 134 } // namespace app_list | 123 } // namespace app_list |
| 135 | 124 |
| 136 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ | 125 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ |
| OLD | NEW |