OLD | NEW |
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/views/view.h" | 11 #include "ui/views/view.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class BoundsAnimator; | 18 class BoundsAnimator; |
19 class ViewModel; | 19 class ViewModel; |
20 } | 20 } |
21 | 21 |
22 namespace app_list { | 22 namespace app_list { |
23 | 23 |
24 class AppsGridView; | 24 class AppsGridView; |
25 class ApplicationDragAndDropHost; | 25 class ApplicationDragAndDropHost; |
26 class AppListFolderItem; | |
27 class AppListMainView; | 26 class AppListMainView; |
28 class AppListModel; | 27 class AppListModel; |
29 class AppListViewDelegate; | 28 class AppListViewDelegate; |
30 class AppsContainerView; | |
31 class PaginationModel; | 29 class PaginationModel; |
32 | 30 |
33 // A view to manage sub views under the search box (apps grid view + page | 31 // A view to manage sub views under the search box (apps grid view + page |
34 // switcher and search results). The two sets of sub views are mutually | 32 // switcher and search results). The two sets of sub views are mutually |
35 // exclusive. ContentsView manages a show state to choose one set to show | 33 // exclusive. ContentsView manages a show state to choose one set to show |
36 // and animates the transition between show states. | 34 // and animates the transition between show states. |
37 class ContentsView : public views::View { | 35 class ContentsView : public views::View { |
38 public: | 36 public: |
39 ContentsView(AppListMainView* app_list_main_view, | 37 ContentsView(AppListMainView* app_list_main_view, |
40 PaginationModel* pagination_model, | 38 PaginationModel* pagination_model, |
41 AppListModel* model, | 39 AppListModel* model, |
42 content::WebContents* start_page_contents); | 40 content::WebContents* start_page_contents); |
43 virtual ~ContentsView(); | 41 virtual ~ContentsView(); |
44 | 42 |
45 // The app list gets closed and drag and drop operations need to be cancelled. | 43 // The app list gets closed and drag and drop operations need to be cancelled. |
46 void CancelDrag(); | 44 void CancelDrag(); |
47 | 45 |
48 // If |drag_and_drop| is not NULL it will be called upon drag and drop | 46 // If |drag_and_drop| is not NULL it will be called upon drag and drop |
49 // operations outside the application list. | 47 // operations outside the application list. |
50 void SetDragAndDropHostOfCurrentAppList( | 48 void SetDragAndDropHostOfCurrentAppList( |
51 ApplicationDragAndDropHost* drag_and_drop_host); | 49 ApplicationDragAndDropHost* drag_and_drop_host); |
52 | 50 |
53 void ShowSearchResults(bool show); | 51 void ShowSearchResults(bool show); |
54 void ShowFolderContent(AppListFolderItem* folder); | |
55 | 52 |
56 void Prerender(); | 53 void Prerender(); |
57 | 54 |
58 AppsContainerView* apps_container_view() { return apps_container_view_; } | |
59 | |
60 private: | 55 private: |
61 enum ShowState { | 56 enum ShowState { |
62 SHOW_APPS, | 57 SHOW_APPS, |
63 SHOW_SEARCH_RESULTS, | 58 SHOW_SEARCH_RESULTS, |
64 }; | 59 }; |
65 | 60 |
66 // Sets show state. | 61 // Sets show state. |
67 void SetShowState(ShowState show_state); | 62 void SetShowState(ShowState show_state); |
68 | 63 |
69 // Invoked when show state is changed. | 64 // Invoked when show state is changed. |
70 void ShowStateChanged(); | 65 void ShowStateChanged(); |
71 | 66 |
72 void CalculateIdealBounds(); | 67 void CalculateIdealBounds(); |
73 void AnimateToIdealBounds(); | 68 void AnimateToIdealBounds(); |
74 | 69 |
75 // Overridden from views::View: | 70 // Overridden from views::View: |
76 virtual gfx::Size GetPreferredSize() OVERRIDE; | 71 virtual gfx::Size GetPreferredSize() OVERRIDE; |
77 virtual void Layout() OVERRIDE; | 72 virtual void Layout() OVERRIDE; |
78 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 73 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
79 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 74 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
80 | 75 |
81 // Overridden from ui::EventHandler: | 76 // Overridden from ui::EventHandler: |
82 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 77 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
83 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 78 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
84 | 79 |
85 ShowState show_state_; | 80 ShowState show_state_; |
86 PaginationModel* pagination_model_; // Owned by AppListController. | 81 PaginationModel* pagination_model_; // Owned by AppListController. |
87 | 82 |
88 AppsContainerView* apps_container_view_; // Owned by the views hierarchy. | 83 AppsGridView* apps_grid_view_; // Owned by the view. |
89 | 84 |
90 scoped_ptr<views::ViewModel> view_model_; | 85 scoped_ptr<views::ViewModel> view_model_; |
91 scoped_ptr<views::BoundsAnimator> bounds_animator_; | 86 scoped_ptr<views::BoundsAnimator> bounds_animator_; |
92 | 87 |
93 DISALLOW_COPY_AND_ASSIGN(ContentsView); | 88 DISALLOW_COPY_AND_ASSIGN(ContentsView); |
94 }; | 89 }; |
95 | 90 |
96 } // namespace app_list | 91 } // namespace app_list |
97 | 92 |
98 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 93 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ |
OLD | NEW |