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 ASH_APP_LIST_APP_LIST_VIEW_H_ |
6 #define ASH_APP_LIST_APP_LIST_VIEW_H_ | 6 #define ASH_APP_LIST_APP_LIST_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/app_list/app_list_item_view_listener.h" | |
10 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/views/controls/button/button.h" |
12 #include "ui/views/widget/widget_delegate.h" | 12 #include "ui/views/widget/widget_delegate.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 class View; | 15 class View; |
16 } | 16 } |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 | 19 |
20 class AppListModel; | 20 class AppListModel; |
| 21 class AppListModelView; |
21 class AppListViewDelegate; | 22 class AppListViewDelegate; |
22 | 23 |
23 // AppListView is the top-level view and controller of app list UI. It creates | 24 // AppListView is the top-level view and controller of app list UI. It creates |
24 // and hosts a AppListModelView and passes AppListModel to it for display. | 25 // and hosts a AppListModelView and passes AppListModel to it for display. |
25 class ASH_EXPORT AppListView : public views::WidgetDelegateView, | 26 class ASH_EXPORT AppListView : public views::WidgetDelegateView, |
26 public AppListItemViewListener { | 27 public views::ButtonListener { |
27 public: | 28 public: |
28 // Takes ownership of |model| and |delegate|. | 29 // Takes ownership of |delegate|. |
29 AppListView(AppListModel* model, | 30 AppListView(AppListViewDelegate* delegate, |
30 AppListViewDelegate* delegate, | |
31 const gfx::Rect& bounds); | 31 const gfx::Rect& bounds); |
32 virtual ~AppListView(); | 32 virtual ~AppListView(); |
33 | 33 |
34 // Closes app list. | 34 // Closes app list. |
35 void Close(); | 35 void Close(); |
36 | 36 |
37 private: | 37 private: |
38 // Initializes the window. | 38 // Initializes the window. |
39 void Init(const gfx::Rect& bounds); | 39 void Init(const gfx::Rect& bounds); |
40 | 40 |
| 41 // Updates model using query text in search box. |
| 42 void UpdateModel(); |
| 43 |
| 44 // Overridden from views::WidgetDelegateView: |
| 45 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 46 |
41 // Overridden from views::View: | 47 // Overridden from views::View: |
| 48 virtual void Layout() OVERRIDE; |
42 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 49 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
43 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 50 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
44 | 51 |
45 // Overridden from AppListItemModelViewListener: | 52 // Overridden from views::ButtonListener: |
46 virtual void AppListItemActivated(AppListItemView* sender, | 53 virtual void ButtonPressed(views::Button* sender, |
47 int event_flags) OVERRIDE; | 54 const views::Event& event) OVERRIDE; |
48 | 55 |
49 scoped_ptr<AppListModel> model_; | 56 scoped_ptr<AppListModel> model_; |
50 | 57 |
51 scoped_ptr<AppListViewDelegate> delegate_; | 58 scoped_ptr<AppListViewDelegate> delegate_; |
52 | 59 |
| 60 AppListModelView* model_view_; |
| 61 |
53 DISALLOW_COPY_AND_ASSIGN(AppListView); | 62 DISALLOW_COPY_AND_ASSIGN(AppListView); |
54 }; | 63 }; |
55 | 64 |
56 } // namespace ash | 65 } // namespace ash |
57 | 66 |
58 #endif // ASH_APP_LIST_APP_LIST_VIEW_H_ | 67 #endif // ASH_APP_LIST_APP_LIST_VIEW_H_ |
OLD | NEW |