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

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

Issue 291653003: Add a unit test for the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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_view_unittest.cc ('k') | ui/app_list/views/contents_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CONTENTS_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_
6 #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ui/app_list/app_list_export.h"
11 #include "ui/views/view.h" 12 #include "ui/views/view.h"
12 13
13 namespace content { 14 namespace content {
14 class WebContents; 15 class WebContents;
15 } 16 }
16 17
17 namespace views { 18 namespace views {
18 class BoundsAnimator; 19 class BoundsAnimator;
19 class ViewModel; 20 class ViewModel;
20 } 21 }
21 22
22 namespace app_list { 23 namespace app_list {
23 24
24 class AppsGridView; 25 class AppsGridView;
25 class ApplicationDragAndDropHost; 26 class ApplicationDragAndDropHost;
26 class AppListFolderItem; 27 class AppListFolderItem;
27 class AppListMainView; 28 class AppListMainView;
28 class AppListModel; 29 class AppListModel;
29 class AppListViewDelegate; 30 class AppListViewDelegate;
30 class AppsContainerView; 31 class AppsContainerView;
31 class PaginationModel; 32 class PaginationModel;
32 class StartPageView; 33 class StartPageView;
33 34
34 // A view to manage sub views under the search box (apps grid view + page 35 // A view to manage sub views under the search box (apps grid view + page
35 // switcher and search results). The two sets of sub views are mutually 36 // switcher and search results). The two sets of sub views are mutually
36 // exclusive. ContentsView manages a show state to choose one set to show 37 // exclusive. ContentsView manages a show state to choose one set to show
37 // and animates the transition between show states. 38 // and animates the transition between show states.
38 class ContentsView : public views::View { 39 class APP_LIST_EXPORT ContentsView : public views::View {
39 public: 40 public:
40 enum ShowState { 41 enum ShowState {
41 SHOW_APPS, 42 SHOW_APPS,
42 SHOW_SEARCH_RESULTS, 43 SHOW_SEARCH_RESULTS,
43 SHOW_START_PAGE, 44 SHOW_START_PAGE,
44 }; 45 };
45 46
46 ContentsView(AppListMainView* app_list_main_view, 47 ContentsView(AppListMainView* app_list_main_view,
47 PaginationModel* pagination_model, 48 PaginationModel* pagination_model,
48 AppListModel* model, 49 AppListModel* model,
(...skipping 10 matching lines...) Expand all
59 60
60 void ShowSearchResults(bool show); 61 void ShowSearchResults(bool show);
61 void ShowFolderContent(AppListFolderItem* folder); 62 void ShowFolderContent(AppListFolderItem* folder);
62 63
63 // Sets show state and animates the subviews to match the show state. 64 // Sets show state and animates the subviews to match the show state.
64 void SetShowState(ShowState show_state); 65 void SetShowState(ShowState show_state);
65 66
66 void Prerender(); 67 void Prerender();
67 68
68 AppsContainerView* apps_container_view() { return apps_container_view_; } 69 AppsContainerView* apps_container_view() { return apps_container_view_; }
70 StartPageView* start_page_view() { return start_page_view_; }
69 71
70 ShowState show_state() const { return show_state_; } 72 ShowState show_state() const { return show_state_; }
71 73
72 // Overridden from views::View: 74 // Overridden from views::View:
73 virtual gfx::Size GetPreferredSize() OVERRIDE; 75 virtual gfx::Size GetPreferredSize() OVERRIDE;
74 virtual void Layout() OVERRIDE; 76 virtual void Layout() OVERRIDE;
75 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 77 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
76 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; 78 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
77 79
78 private: 80 private:
79 // Invoked when show state is changed. 81 // Invoked when show state is changed.
80 void ShowStateChanged(); 82 void ShowStateChanged();
81 83
82 void CalculateIdealBounds(); 84 void CalculateIdealBounds();
83 void AnimateToIdealBounds(); 85 void AnimateToIdealBounds();
84 86
85 // Overridden from ui::EventHandler: 87 // Overridden from ui::EventHandler:
86 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 88 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
87 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; 89 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
88 90
89 ShowState show_state_; 91 ShowState show_state_;
90 PaginationModel* pagination_model_; // Owned by AppListController. 92 PaginationModel* pagination_model_; // Owned by AppListController.
91 93
92 AppsContainerView* apps_container_view_; // Owned by the views hierarchy. 94 AppsContainerView* apps_container_view_; // Owned by the views hierarchy.
95 StartPageView* start_page_view_; // Owned by the views hierarchy.
96
93 AppListMainView* app_list_main_view_; // Parent view, owns this. 97 AppListMainView* app_list_main_view_; // Parent view, owns this.
94 98
95 scoped_ptr<views::ViewModel> view_model_; 99 scoped_ptr<views::ViewModel> view_model_;
96 scoped_ptr<views::BoundsAnimator> bounds_animator_; 100 scoped_ptr<views::BoundsAnimator> bounds_animator_;
97 101
98 DISALLOW_COPY_AND_ASSIGN(ContentsView); 102 DISALLOW_COPY_AND_ASSIGN(ContentsView);
99 }; 103 };
100 104
101 } // namespace app_list 105 } // namespace app_list
102 106
103 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ 107 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | ui/app_list/views/contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698