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

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

Issue 140203003: Implement animation UI for opening/closing an app list folder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address code review comments. Created 6 years, 11 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
« no previous file with comments | « ui/app_list/views/app_list_item_view.cc ('k') | ui/app_list/views/apps_container_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/app_list/app_list_folder_item.h"
8 #include "ui/views/view.h" 9 #include "ui/views/view.h"
9 10
10 namespace content { 11 namespace content {
11 class WebContents; 12 class WebContents;
12 } 13 }
13 14
14 namespace app_list { 15 namespace app_list {
15 16
16 class AppsGridView; 17 class AppsGridView;
17 class AppListFolderItem; 18 class AppListFolderItem;
18 class AppListFolderView; 19 class AppListFolderView;
19 class AppListMainView; 20 class AppListMainView;
20 class AppListModel; 21 class AppListModel;
21 class ContentsView; 22 class ContentsView;
22 class PaginationModel; 23 class PaginationModel;
23 24
25 class TopIconAnimationObserver {
26 public:
27 // Called when top icon animation completes.
28 virtual void OnTopIconAnimationsComplete(views::View* icon_view) {}
29
30 protected:
31 TopIconAnimationObserver() {}
32 virtual ~TopIconAnimationObserver() {}
33
34 private:
35 DISALLOW_COPY_AND_ASSIGN(TopIconAnimationObserver);
36 };
37
24 // AppsContainerView contains a root level AppsGridView to render the root level 38 // AppsContainerView contains a root level AppsGridView to render the root level
25 // app items, and a AppListFolderView to render the app items inside the 39 // app items, and a AppListFolderView to render the app items inside the
26 // active folder. Only one if them is visible to user at any time. 40 // active folder. Only one if them is visible to user at any time.
27 class AppsContainerView : public views::View { 41 class AppsContainerView : public views::View,
42 public TopIconAnimationObserver {
28 public: 43 public:
29 AppsContainerView(AppListMainView* app_list_main_view, 44 AppsContainerView(AppListMainView* app_list_main_view,
30 PaginationModel* pagination_model, 45 PaginationModel* pagination_model,
31 AppListModel* model, 46 AppListModel* model,
32 content::WebContents* start_page_contents); 47 content::WebContents* start_page_contents);
33 virtual ~AppsContainerView(); 48 virtual ~AppsContainerView();
34 49
35 // Shows the active folder content specified by |folder_item|. 50 // Shows the active folder content specified by |folder_item|.
36 void ShowActiveFolder(AppListFolderItem* folder_item); 51 void ShowActiveFolder(AppListFolderItem* folder_item);
37 52
38 // Shows the apps list from root. 53 // Shows the root level apps list. This is called when UI navigate back from
39 void ShowApps(); 54 // a folder view with |folder_item|.
55 void ShowApps(AppListFolderItem* folder_item);
40 56
41 // Overridden from views::View: 57 // Overridden from views::View:
42 virtual gfx::Size GetPreferredSize() OVERRIDE; 58 virtual gfx::Size GetPreferredSize() OVERRIDE;
43 virtual void Layout() OVERRIDE; 59 virtual void Layout() OVERRIDE;
44 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 60 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
45 61
62 // Overridden from TopIconAnimationObserver.
63 virtual void OnTopIconAnimationsComplete(views::View* icon_view) OVERRIDE;
64
46 AppsGridView* apps_grid_view() { return apps_grid_view_; } 65 AppsGridView* apps_grid_view() { return apps_grid_view_; }
47 66
48 private: 67 private:
49 enum ShowState { 68 enum ShowState {
50 SHOW_APPS, 69 SHOW_APPS,
51 SHOW_ACTIVE_FOLDER, 70 SHOW_ACTIVE_FOLDER,
52 }; 71 };
53 72
54 void SetShowState(ShowState show_state); 73 void SetShowState(ShowState show_state);
55 74
75 // Calculates the top item icon bounds in the active folder icon. The bounds
76 // is relative to AppsContainerView.
77 // Returns the bounds of top items' icon in sequence of top left, top right,
78 // bottom left, bottom right.
79 Rects GetTopItemIconBoundsInActiveFolder();
80
81 // Creates the transitional views for animating the top items in the folder
82 // when opening or closing a folder.
83 void CreateViewsForFolderTopItemsAnimation(
84 AppListFolderItem* active_folder, bool open_folder);
85
56 AppListModel* model_; 86 AppListModel* model_;
57 AppsGridView* apps_grid_view_; // Owned by views hierarchy. 87 AppsGridView* apps_grid_view_; // Owned by views hierarchy.
58 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy. 88 AppListFolderView* app_list_folder_view_; // Owned by views hierarchy.
59 ShowState show_state_; 89 ShowState show_state_;
60 90
91 // The transitional views for animating the top items in folder
92 // when opening or closing a folder.
93 std::vector<views::View*> top_icon_views_;
94
61 DISALLOW_COPY_AND_ASSIGN(AppsContainerView); 95 DISALLOW_COPY_AND_ASSIGN(AppsContainerView);
62 }; 96 };
63 97
64 } // namespace app_list 98 } // namespace app_list
65 99
66 100
67 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_ 101 #endif // UI_APP_LIST_VIEWS_APPS_CONTAINER_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_item_view.cc ('k') | ui/app_list/views/apps_container_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698