| 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 UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/app_list/app_list_export.h" | 9 #include "ui/app_list/app_list_export.h" |
| 10 #include "ui/app_list/signin_delegate_observer.h" | |
| 11 #include "ui/views/bubble/bubble_delegate.h" | 10 #include "ui/views/bubble/bubble_delegate.h" |
| 12 | 11 |
| 13 namespace views { | 12 namespace views { |
| 14 class Widget; | 13 class Widget; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace app_list { | 16 namespace app_list { |
| 18 | 17 |
| 19 class AppListMainView; | 18 class AppListMainView; |
| 20 class AppListModel; | 19 class AppListModel; |
| 21 class AppListViewDelegate; | 20 class AppListViewDelegate; |
| 22 class PaginationModel; | 21 class PaginationModel; |
| 23 class SigninDelegate; | |
| 24 class SigninView; | |
| 25 | 22 |
| 26 // 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 |
| 27 // and hosts a AppsGridView and passes AppListModel to it for display. | 24 // and hosts a AppsGridView and passes AppListModel to it for display. |
| 28 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, | 25 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView { |
| 29 public SigninDelegateObserver { | |
| 30 public: | 26 public: |
| 31 // Takes ownership of |delegate|. | 27 // Takes ownership of |delegate|. |
| 32 explicit AppListView(AppListViewDelegate* delegate); | 28 explicit AppListView(AppListViewDelegate* delegate); |
| 33 virtual ~AppListView(); | 29 virtual ~AppListView(); |
| 34 | 30 |
| 35 // Initializes the widget. | 31 // Initializes the widget. |
| 36 void InitAsBubble(gfx::NativeView parent, | 32 void InitAsBubble(gfx::NativeView parent, |
| 37 PaginationModel* pagination_model, | 33 PaginationModel* pagination_model, |
| 38 views::View* anchor, | 34 views::View* anchor, |
| 39 const gfx::Point& anchor_point, | 35 const gfx::Point& anchor_point, |
| 40 views::BubbleBorder::ArrowLocation arrow_location); | 36 views::BubbleBorder::ArrowLocation arrow_location); |
| 41 | 37 |
| 42 void SetBubbleArrowLocation( | 38 void SetBubbleArrowLocation( |
| 43 views::BubbleBorder::ArrowLocation arrow_location); | 39 views::BubbleBorder::ArrowLocation arrow_location); |
| 44 | 40 |
| 45 void SetAnchorPoint(const gfx::Point& anchor_point); | 41 void SetAnchorPoint(const gfx::Point& anchor_point); |
| 46 | 42 |
| 47 // Shows the UI when there are no pending icon loads. Otherwise, starts a | 43 // Shows the UI when there are no pending icon loads. Otherwise, starts a |
| 48 // timer to show the UI when a maximum allowed wait time has expired. | 44 // timer to show the UI when a maximum allowed wait time has expired. |
| 49 void ShowWhenReady(); | 45 void ShowWhenReady(); |
| 50 | 46 |
| 51 void Close(); | 47 void Close(); |
| 52 | 48 |
| 53 void UpdateBounds(); | 49 void UpdateBounds(); |
| 54 | 50 |
| 55 // Overridden from views::View: | |
| 56 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 57 | |
| 58 private: | 51 private: |
| 59 // Overridden from views::WidgetDelegateView: | 52 // Overridden from views::WidgetDelegateView: |
| 60 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 53 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 61 virtual bool WidgetHasHitTestMask() const OVERRIDE; | 54 virtual bool WidgetHasHitTestMask() const OVERRIDE; |
| 62 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; | 55 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; |
| 63 | 56 |
| 64 // Overridden from views::View: | 57 // Overridden from views::View: |
| 65 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 58 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 66 virtual void Layout() OVERRIDE; | |
| 67 | 59 |
| 68 // Overridden from views::WidgetObserver: | 60 // Overridden from views::WidgetObserver: |
| 69 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 61 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 70 virtual void OnWidgetVisibilityChanged( | 62 virtual void OnWidgetActivationChanged(views::Widget* widget, bool active) |
| 71 views::Widget* widget, bool visible) OVERRIDE; | 63 OVERRIDE; |
| 72 virtual void OnWidgetActivationChanged( | |
| 73 views::Widget* widget, bool active) OVERRIDE; | |
| 74 | |
| 75 // Overridden from SigninDelegateObserver: | |
| 76 virtual void OnSigninSuccess() OVERRIDE; | |
| 77 | |
| 78 SigninDelegate* GetSigninDelegate(); | |
| 79 | 64 |
| 80 scoped_ptr<AppListModel> model_; | 65 scoped_ptr<AppListModel> model_; |
| 81 scoped_ptr<AppListViewDelegate> delegate_; | 66 scoped_ptr<AppListViewDelegate> delegate_; |
| 82 | 67 |
| 83 AppListMainView* app_list_main_view_; | 68 AppListMainView* app_list_main_view_; |
| 84 SigninView* signin_view_; | |
| 85 | 69 |
| 86 DISALLOW_COPY_AND_ASSIGN(AppListView); | 70 DISALLOW_COPY_AND_ASSIGN(AppListView); |
| 87 }; | 71 }; |
| 88 | 72 |
| 89 } // namespace app_list | 73 } // namespace app_list |
| 90 | 74 |
| 91 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 75 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
| OLD | NEW |