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