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