OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_APP_LIST_APP_LIST_VIEW_H_ | |
6 #define ASH_APP_LIST_APP_LIST_VIEW_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ui/views/bubble/bubble_delegate.h" | |
11 #include "ui/views/controls/button/button.h" | |
12 | |
13 namespace views { | |
14 class View; | |
15 } | |
16 | |
17 namespace ash { | |
18 | |
19 class AppListBubbleBorder; | |
20 class AppListModel; | |
21 class AppListModelView; | |
22 class AppListViewDelegate; | |
23 class PaginationModel; | |
24 | |
25 // 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 class AppListView : public views::BubbleDelegateView, | |
28 public views::ButtonListener { | |
29 public: | |
30 // Takes ownership of |delegate|. | |
31 explicit AppListView(AppListViewDelegate* delegate); | |
32 virtual ~AppListView(); | |
33 | |
34 void AnimateShow(int duration_ms); | |
35 void AnimateHide(int duration_ms); | |
36 | |
37 void Close(); | |
38 void UpdateBounds(); | |
39 | |
40 private: | |
41 // Initializes the window. | |
42 void InitAsFullscreenWidget(); | |
43 void InitAsBubble(); | |
44 | |
45 // Updates model using query text in search box. | |
46 void UpdateModel(); | |
47 | |
48 // Overridden from views::WidgetDelegateView: | |
49 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | |
50 | |
51 // Overridden from views::View: | |
52 virtual void Layout() OVERRIDE; | |
53 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | |
54 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | |
55 | |
56 // Overridden from views::ButtonListener: | |
57 virtual void ButtonPressed(views::Button* sender, | |
58 const views::Event& event) OVERRIDE; | |
59 | |
60 // Overridden from views::BubbleDelegate: | |
61 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | |
62 | |
63 scoped_ptr<AppListModel> model_; | |
64 scoped_ptr<AppListViewDelegate> delegate_; | |
65 | |
66 // PaginationModel for model view and page switcher. | |
67 scoped_ptr<PaginationModel> pagination_model_; | |
68 | |
69 bool bubble_style_; | |
70 AppListBubbleBorder* bubble_border_; // Owned by views hierarchy. | |
71 AppListModelView* model_view_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(AppListView); | |
74 }; | |
75 | |
76 } // namespace ash | |
77 | |
78 #endif // ASH_APP_LIST_APP_LIST_VIEW_H_ | |
OLD | NEW |