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