Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: ui/app_list/views/app_list_folder_view.h

Issue 136303008: Implement ui for re-parenting an item from an app list folder to another position or folder in the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
xiyuan 2014/02/06 22:45:12 nit: This can go in cc file.
jennyz 2014/02/07 00:03:10 Since AppsGridView::Pointer is used in DispatchDra
xiyuan 2014/02/07 00:32:19 I see. Yep, enum could not be forward declared.
9 #include "ui/app_list/views/folder_header_view.h" 10 #include "ui/app_list/views/folder_header_view.h"
10 #include "ui/app_list/views/folder_header_view_delegate.h" 11 #include "ui/app_list/views/folder_header_view_delegate.h"
11 #include "ui/compositor/layer_animation_observer.h" 12 #include "ui/compositor/layer_animation_observer.h"
12 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
13 #include "ui/views/view.h" 14 #include "ui/views/view.h"
14 15
15 namespace content { 16 namespace content {
16 class WebContents; 17 class WebContents;
17 } 18 }
18 19
19 namespace views { 20 namespace views {
20 class ViewModel; 21 class ViewModel;
21 } 22 }
22 23
23 namespace app_list { 24 namespace app_list {
24 25
25 class AppsContainerView; 26 class AppsContainerView;
26 class AppsGridView; 27 class AppsGridView;
27 class AppListFolderItem; 28 class AppListFolderItem;
29 class AppListItemView;
28 class AppListMainView; 30 class AppListMainView;
29 class AppListModel; 31 class AppListModel;
30 class FolderHeaderView; 32 class FolderHeaderView;
31 class PaginationModel; 33 class PaginationModel;
32 34
33 class AppListFolderView : public views::View, 35 class AppListFolderView : public views::View,
34 public FolderHeaderViewDelegate, 36 public FolderHeaderViewDelegate,
35 public AppListItemListObserver, 37 public AppListItemListObserver,
36 public ui::ImplicitAnimationObserver { 38 public ui::ImplicitAnimationObserver {
37 public: 39 public:
38 AppListFolderView(AppsContainerView* container_view, 40 AppListFolderView(AppsContainerView* container_view,
39 AppListModel* model, 41 AppListModel* model,
40 AppListMainView* app_list_main_view, 42 AppListMainView* app_list_main_view,
41 content::WebContents* start_page_contents); 43 content::WebContents* start_page_contents);
42 virtual ~AppListFolderView(); 44 virtual ~AppListFolderView();
43 45
44 void SetAppListFolderItem(AppListFolderItem* folder); 46 void SetAppListFolderItem(AppListFolderItem* folder);
45 47
46 // Schedules an animation to show or hide the view. 48 // Schedules an animation to show or hide the view.
47 void ScheduleShowHideAnimation(bool show); 49 // If |show| is false, the view should be set to invisible after the
50 // animation is done unless |hide_for_reparent| is true.
51 void ScheduleShowHideAnimation(bool show, bool hide_for_reparent);
48 52
49 // Gets icon image bounds of the item at |index|, relative to 53 // Gets icon image bounds of the item at |index|, relative to
50 // AppListFolderView. 54 // AppListFolderView.
51 gfx::Rect GetItemIconBoundsAt(int index); 55 gfx::Rect GetItemIconBoundsAt(int index);
52 56
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);
62
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);
xiyuan 2014/02/06 22:45:12 nit: 4-space indent
jennyz 2014/02/07 00:03:10 Done.
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 bool hide_for_reparent() const { return hide_for_reparent_; }
xiyuan 2014/02/06 22:45:12 nit: accessor at the last section of methods
jennyz 2014/02/07 00:03:10 Done.
85
53 // views::View overrides: 86 // views::View overrides:
54 virtual gfx::Size GetPreferredSize() OVERRIDE; 87 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 virtual void Layout() OVERRIDE; 88 virtual void Layout() OVERRIDE;
56 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 89 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
57 90
58 // Overridden from AppListItemListObserver: 91 // Overridden from AppListItemListObserver:
59 virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE; 92 virtual void OnListItemRemoved(size_t index, AppListItem* item) OVERRIDE;
60 93
61 // ui::ImplicitAnimationObserver overrides: 94 // ui::ImplicitAnimationObserver overrides:
62 virtual void OnImplicitAnimationsCompleted() OVERRIDE; 95 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
63 96
97 AppsGridView* items_grid_view() { return items_grid_view_; }
98
64 private: 99 private:
65 void CalculateIdealBounds(); 100 void CalculateIdealBounds();
66 101
102 // Starts setting up drag in root level apps grid view for re-parenting a
103 // folder item.
104 // |drag_point_in_root_grid| is in the cooridnates of root level AppsGridView.
105 void StartSetupDragInRootLevelAppsGridView(
106 AppListItemView* original_drag_view,
107 const gfx::Point& drag_point_in_root_grid);
108
67 // Overridden from FolderHeaderViewDelegate: 109 // Overridden from FolderHeaderViewDelegate:
68 virtual void NavigateBack(AppListFolderItem* item, 110 virtual void NavigateBack(AppListFolderItem* item,
69 const ui::Event& event_flags) OVERRIDE; 111 const ui::Event& event_flags) OVERRIDE;
70 112
71 AppsContainerView* container_view_; // Not owned. 113 AppsContainerView* container_view_; // Not owned.
72 FolderHeaderView* folder_header_view_; // Owned by views hierarchy. 114 FolderHeaderView* folder_header_view_; // Owned by views hierarchy.
73 AppsGridView* items_grid_view_; // Owned by the views hierarchy. 115 AppsGridView* items_grid_view_; // Owned by the views hierarchy.
74 116
75 scoped_ptr<views::ViewModel> view_model_; 117 scoped_ptr<views::ViewModel> view_model_;
76 118
77 AppListModel* model_; // Not owned. 119 AppListModel* model_; // Not owned.
78 AppListFolderItem* folder_item_; // Not owned. 120 AppListFolderItem* folder_item_; // Not owned.
79 121
80 scoped_ptr<PaginationModel> pagination_model_; 122 scoped_ptr<PaginationModel> pagination_model_;
81 123
124 bool hide_for_reparent_;
125
82 DISALLOW_COPY_AND_ASSIGN(AppListFolderView); 126 DISALLOW_COPY_AND_ASSIGN(AppListFolderView);
83 }; 127 };
84 128
85 } // namespace app_list 129 } // namespace app_list
86 130
87 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_ 131 #endif // UI_APP_LIST_VIEWS_APP_LIST_FOLDER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698