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 ASH_APP_LIST_APP_LIST_VIEW_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_VIEW_H_ |
6 #define ASH_APP_LIST_APP_LIST_VIEW_H_ | 6 #define UI_APP_LIST_APP_LIST_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/app_list/app_list_export.h" |
10 #include "ui/views/bubble/bubble_delegate.h" | 11 #include "ui/views/bubble/bubble_delegate.h" |
11 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
12 | 13 |
13 namespace views { | 14 namespace views { |
14 class View; | 15 class View; |
15 } | 16 } |
16 | 17 |
17 namespace ash { | 18 namespace app_list { |
18 | 19 |
19 class AppListBubbleBorder; | 20 class AppListBubbleBorder; |
20 class AppListModel; | 21 class AppListModel; |
21 class AppListModelView; | 22 class AppListModelView; |
22 class AppListViewDelegate; | 23 class AppListViewDelegate; |
23 class PaginationModel; | 24 class PaginationModel; |
24 | 25 |
25 // AppListView is the top-level view and controller of app list UI. It creates | 26 // AppListView is the top-level view and controller of app list UI. It creates |
26 // and hosts a AppListModelView and passes AppListModel to it for display. | 27 // and hosts a AppListModelView and passes AppListModel to it for display. |
27 class AppListView : public views::BubbleDelegateView, | 28 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, |
28 public views::ButtonListener { | 29 public views::ButtonListener { |
29 public: | 30 public: |
30 // Takes ownership of |delegate|. | 31 // Takes ownership of |delegate|. |
31 explicit AppListView(AppListViewDelegate* delegate); | 32 explicit AppListView(AppListViewDelegate* delegate); |
32 virtual ~AppListView(); | 33 virtual ~AppListView(); |
33 | 34 |
| 35 // Initializes the widget. |
| 36 void InitAsFullscreenWidget(gfx::NativeView parent, |
| 37 const gfx::Rect& screen_bounds, |
| 38 const gfx::Rect& work_area); |
| 39 void InitAsBubble(gfx::NativeView parent, views::View* anchor); |
| 40 |
34 void AnimateShow(int duration_ms); | 41 void AnimateShow(int duration_ms); |
35 void AnimateHide(int duration_ms); | 42 void AnimateHide(int duration_ms); |
36 | 43 |
37 void Close(); | 44 void Close(); |
38 void UpdateBounds(); | 45 void UpdateBounds(const gfx::Rect& screen_bounds, |
| 46 const gfx::Rect& work_area); |
39 | 47 |
40 private: | 48 private: |
41 // Initializes the window. | |
42 void InitAsFullscreenWidget(); | |
43 void InitAsBubble(); | |
44 | |
45 // Updates model using query text in search box. | 49 // Updates model using query text in search box. |
46 void UpdateModel(); | 50 void UpdateModel(); |
47 | 51 |
48 // Overridden from views::WidgetDelegateView: | 52 // Overridden from views::WidgetDelegateView: |
49 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 53 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
50 | 54 |
51 // Overridden from views::View: | 55 // Overridden from views::View: |
52 virtual void Layout() OVERRIDE; | 56 virtual void Layout() OVERRIDE; |
53 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 57 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
54 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 58 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
55 | 59 |
56 // Overridden from views::ButtonListener: | 60 // Overridden from views::ButtonListener: |
57 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
58 const views::Event& event) OVERRIDE; | 62 const views::Event& event) OVERRIDE; |
59 | 63 |
60 // Overridden from views::BubbleDelegate: | 64 // Overridden from views::BubbleDelegate: |
61 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 65 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
62 | 66 |
63 scoped_ptr<AppListModel> model_; | 67 scoped_ptr<AppListModel> model_; |
64 scoped_ptr<AppListViewDelegate> delegate_; | 68 scoped_ptr<AppListViewDelegate> delegate_; |
65 | 69 |
66 // PaginationModel for model view and page switcher. | 70 // PaginationModel for model view and page switcher. |
67 scoped_ptr<PaginationModel> pagination_model_; | 71 scoped_ptr<PaginationModel> pagination_model_; |
68 | 72 |
69 bool bubble_style_; | 73 bool bubble_style_; |
70 AppListBubbleBorder* bubble_border_; // Owned by views hierarchy. | 74 AppListBubbleBorder* bubble_border_; // Owned by views hierarchy. |
71 AppListModelView* model_view_; | 75 AppListModelView* model_view_; |
72 | 76 |
| 77 // Work area in screen coordinates to layout app list. This is used for |
| 78 // full screen mode. |
| 79 gfx::Rect work_area_; |
| 80 |
73 DISALLOW_COPY_AND_ASSIGN(AppListView); | 81 DISALLOW_COPY_AND_ASSIGN(AppListView); |
74 }; | 82 }; |
75 | 83 |
76 } // namespace ash | 84 } // namespace app_list |
77 | 85 |
78 #endif // ASH_APP_LIST_APP_LIST_VIEW_H_ | 86 #endif // UI_APP_LIST_APP_LIST_VIEW_H_ |
OLD | NEW |