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