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

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

Issue 497413003: Refactor app list event handling and prerendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved some app-grid-specific logic from ContentsView to AppsGridView. Created 6 years, 3 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
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_APPS_CONTAINER_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ui/app_list/app_list_folder_item.h" 10 #include "ui/app_list/app_list_folder_item.h"
11 #include "ui/app_list/views/top_icon_animation_view.h" 11 #include "ui/app_list/views/top_icon_animation_view.h"
12 #include "ui/views/view.h" 12 #include "ui/views/view.h"
13 13
14 namespace app_list { 14 namespace app_list {
15 15
16 class AppsGridView; 16 class AppsGridView;
17 class ApplicationDragAndDropHost; 17 class ApplicationDragAndDropHost;
18 class AppListFolderItem; 18 class AppListFolderItem;
19 class AppListFolderView; 19 class AppListFolderView;
20 class AppListMainView; 20 class AppListMainView;
21 class AppListModel; 21 class AppListModel;
22 class ContentsView; 22 class ContentsView;
23 class FolderBackgroundView; 23 class FolderBackgroundView;
24 class PaginationModel;
24 25
25 // AppsContainerView contains a root level AppsGridView to render the root level 26 // AppsContainerView contains a root level AppsGridView to render the root level
26 // app items, and a AppListFolderView to render the app items inside the 27 // app items, and a AppListFolderView to render the app items inside the
27 // active folder. Only one if them is visible to user at any time. 28 // active folder. Only one if them is visible to user at any time.
28 class AppsContainerView : public views::View, 29 class AppsContainerView : public views::View,
29 public TopIconAnimationObserver { 30 public TopIconAnimationObserver {
30 public: 31 public:
31 AppsContainerView(AppListMainView* app_list_main_view, 32 AppsContainerView(AppListMainView* app_list_main_view,
32 AppListModel* model); 33 AppListModel* model);
33 virtual ~AppsContainerView(); 34 virtual ~AppsContainerView();
(...skipping 20 matching lines...) Expand all
54 // re-parenting a child item of |folder_item|. 55 // re-parenting a child item of |folder_item|.
55 void ReparentFolderItemTransit(AppListFolderItem* folder_item); 56 void ReparentFolderItemTransit(AppListFolderItem* folder_item);
56 57
57 // Returns true if it is currently showing an active folder page. 58 // Returns true if it is currently showing an active folder page.
58 bool IsInFolderView() const; 59 bool IsInFolderView() const;
59 60
60 // views::View overrides: 61 // views::View overrides:
61 virtual gfx::Size GetPreferredSize() const OVERRIDE; 62 virtual gfx::Size GetPreferredSize() const OVERRIDE;
62 virtual void Layout() OVERRIDE; 63 virtual void Layout() OVERRIDE;
63 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 64 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
65 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
66
67 // Overridden from ui::EventHandler:
68 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
69 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
calamity 2014/08/26 08:12:34 Should this be part of the AppsGridView instead?
Matt Giuca 2014/08/28 00:35:21 Done.
64 70
65 // TopIconAnimationObserver overrides: 71 // TopIconAnimationObserver overrides:
66 virtual void OnTopIconAnimationsComplete() OVERRIDE; 72 virtual void OnTopIconAnimationsComplete() OVERRIDE;
67 73
68 AppsGridView* apps_grid_view() { return apps_grid_view_; } 74 AppsGridView* apps_grid_view() { return apps_grid_view_; }
69 FolderBackgroundView* folder_background_view() { 75 FolderBackgroundView* folder_background_view() {
70 return folder_background_view_; 76 return folder_background_view_;
71 } 77 }
72 AppListFolderView* app_list_folder_view() { return app_list_folder_view_; } 78 AppListFolderView* app_list_folder_view() { return app_list_folder_view_; }
73 79
74 private: 80 private:
75 enum ShowState { 81 enum ShowState {
76 SHOW_NONE, // initial state 82 SHOW_NONE, // initial state
77 SHOW_APPS, 83 SHOW_APPS,
78 SHOW_ACTIVE_FOLDER, 84 SHOW_ACTIVE_FOLDER,
79 SHOW_ITEM_REPARENT, 85 SHOW_ITEM_REPARENT,
80 }; 86 };
81 87
82 void SetShowState(ShowState show_state, bool show_apps_with_animation); 88 void SetShowState(ShowState show_state, bool show_apps_with_animation);
83 89
84 // Calculates the top item icon bounds in the active folder icon. The bounds 90 // Calculates the top item icon bounds in the active folder icon. The bounds
85 // is relative to AppsContainerView. 91 // is relative to AppsContainerView.
86 // Returns the bounds of top items' icon in sequence of top left, top right, 92 // Returns the bounds of top items' icon in sequence of top left, top right,
87 // bottom left, bottom right. 93 // bottom left, bottom right.
88 Rects GetTopItemIconBoundsInActiveFolder(); 94 Rects GetTopItemIconBoundsInActiveFolder();
89 95
96 // Gets the PaginationModel owned by the AppsGridView.
97 PaginationModel* GetPaginationModel();
98
90 // Creates the transitional views for animating the top items in the folder 99 // Creates the transitional views for animating the top items in the folder
91 // when opening or closing a folder. 100 // when opening or closing a folder.
92 void CreateViewsForFolderTopItemsAnimation( 101 void CreateViewsForFolderTopItemsAnimation(
93 AppListFolderItem* active_folder, bool open_folder); 102 AppListFolderItem* active_folder, bool open_folder);
94 103
95 void PrepareToShowApps(AppListFolderItem* folder_item); 104 void PrepareToShowApps(AppListFolderItem* folder_item);
96 105
97 AppListModel* model_; 106 AppListModel* model_;
98 AppsGridView* apps_grid_view_; // Owned by views hierarchy. 107 AppsGridView* apps_grid_view_; // Owned by views hierarchy.
99 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy. 108 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy.
100 FolderBackgroundView* folder_background_view_; // Owned by views hierarchy. 109 FolderBackgroundView* folder_background_view_; // Owned by views hierarchy.
101 ShowState show_state_; 110 ShowState show_state_;
102 111
103 // The transitional views for animating the top items in folder 112 // The transitional views for animating the top items in folder
104 // when opening or closing a folder. 113 // when opening or closing a folder.
105 std::vector<views::View*> top_icon_views_; 114 std::vector<views::View*> top_icon_views_;
106 115
107 size_t top_icon_animation_pending_count_; 116 size_t top_icon_animation_pending_count_;
108 117
109 DISALLOW_COPY_AND_ASSIGN(AppsContainerView); 118 DISALLOW_COPY_AND_ASSIGN(AppsContainerView);
110 }; 119 };
111 120
112 } // namespace app_list 121 } // namespace app_list
113 122
114 123
115 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ 124 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/apps_container_view.cc » ('j') | ui/app_list/views/contents_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698