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 "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "ui/app_list/app_list_export.h" | 10 #include "ui/app_list/app_list_export.h" |
11 #include "ui/app_list/app_list_view_delegate_observer.h" | 11 #include "ui/app_list/app_list_view_delegate_observer.h" |
12 #include "ui/app_list/speech_ui_model_observer.h" | 12 #include "ui/app_list/speech_ui_model_observer.h" |
13 #include "ui/views/bubble/bubble_delegate.h" | 13 #include "ui/views/bubble/bubble_delegate.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
| 20 namespace gfx { |
| 21 class Screen; |
| 22 } |
| 23 |
20 namespace app_list { | 24 namespace app_list { |
21 class ApplicationDragAndDropHost; | 25 class ApplicationDragAndDropHost; |
22 class AppListMainView; | 26 class AppListMainView; |
23 class AppListModel; | 27 class AppListModel; |
24 class AppListViewDelegate; | 28 class AppListViewDelegate; |
25 class AppListViewObserver; | 29 class AppListViewObserver; |
26 class HideViewAnimationObserver; | 30 class HideViewAnimationObserver; |
27 class PaginationModel; | 31 class PaginationModel; |
28 class SigninDelegate; | 32 class SigninDelegate; |
29 class SigninView; | 33 class SigninView; |
(...skipping 20 matching lines...) Expand all Loading... |
50 bool border_accepts_events); | 54 bool border_accepts_events); |
51 | 55 |
52 // Initializes the widget and use a fixed |anchor_point_in_screen| for | 56 // Initializes the widget and use a fixed |anchor_point_in_screen| for |
53 // positioning. | 57 // positioning. |
54 void InitAsBubbleAtFixedLocation(gfx::NativeView parent, | 58 void InitAsBubbleAtFixedLocation(gfx::NativeView parent, |
55 PaginationModel* pagination_model, | 59 PaginationModel* pagination_model, |
56 const gfx::Point& anchor_point_in_screen, | 60 const gfx::Point& anchor_point_in_screen, |
57 views::BubbleBorder::Arrow arrow, | 61 views::BubbleBorder::Arrow arrow, |
58 bool border_accepts_events); | 62 bool border_accepts_events); |
59 | 63 |
| 64 // Initializes the widget and use the center of the primary display for |
| 65 // positioning. |
| 66 void InitAsBubbleCenteredOnPrimaryDisplay( |
| 67 gfx::NativeView parent, |
| 68 PaginationModel* pagination_model, |
| 69 gfx::Screen* screen_to_keep_centered_on, |
| 70 views::BubbleBorder::Arrow arrow, |
| 71 bool border_accepts_events); |
| 72 |
60 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); | 73 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); |
61 | 74 |
62 void SetAnchorPoint(const gfx::Point& anchor_point); | 75 void SetAnchorPoint(const gfx::Point& anchor_point); |
63 | 76 |
64 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop | 77 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop |
65 // operations outside the application list. This has to be called after | 78 // operations outside the application list. This has to be called after |
66 // InitAsBubble was called since the app list object needs to exist so that | 79 // InitAsBubble was called since the app list object needs to exist so that |
67 // it can set the host. | 80 // it can set the host. |
68 void SetDragAndDropHostOfCurrentAppList( | 81 void SetDragAndDropHostOfCurrentAppList( |
69 ApplicationDragAndDropHost* drag_and_drop_host); | 82 ApplicationDragAndDropHost* drag_and_drop_host); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 116 |
104 AppListMainView* app_list_main_view() { return app_list_main_view_; } | 117 AppListMainView* app_list_main_view() { return app_list_main_view_; } |
105 | 118 |
106 private: | 119 private: |
107 void InitAsBubbleInternal(gfx::NativeView parent, | 120 void InitAsBubbleInternal(gfx::NativeView parent, |
108 PaginationModel* pagination_model, | 121 PaginationModel* pagination_model, |
109 views::BubbleBorder::Arrow arrow, | 122 views::BubbleBorder::Arrow arrow, |
110 bool border_accepts_events, | 123 bool border_accepts_events, |
111 const gfx::Vector2d& anchor_offset); | 124 const gfx::Vector2d& anchor_offset); |
112 | 125 |
| 126 // Gets the point at the center of the current screen. |
| 127 // |screen_to_keep_centered_on_| must not be NULL. |
| 128 gfx::Point GetCenterPoint(); |
| 129 |
113 // Overridden from views::BubbleDelegateView: | 130 // Overridden from views::BubbleDelegateView: |
114 virtual void OnBeforeBubbleWidgetInit( | 131 virtual void OnBeforeBubbleWidgetInit( |
115 views::Widget::InitParams* params, | 132 views::Widget::InitParams* params, |
116 views::Widget* widget) const OVERRIDE; | 133 views::Widget* widget) const OVERRIDE; |
117 | 134 |
118 // Overridden from views::WidgetDelegateView: | 135 // Overridden from views::WidgetDelegateView: |
119 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 136 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
120 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; | 137 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
121 virtual bool WidgetHasHitTestMask() const OVERRIDE; | 138 virtual bool WidgetHasHitTestMask() const OVERRIDE; |
122 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; | 139 virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
141 | 158 |
142 scoped_ptr<AppListViewDelegate> delegate_; | 159 scoped_ptr<AppListViewDelegate> delegate_; |
143 | 160 |
144 AppListMainView* app_list_main_view_; | 161 AppListMainView* app_list_main_view_; |
145 SigninView* signin_view_; | 162 SigninView* signin_view_; |
146 SpeechView* speech_view_; | 163 SpeechView* speech_view_; |
147 | 164 |
148 ObserverList<AppListViewObserver> observers_; | 165 ObserverList<AppListViewObserver> observers_; |
149 scoped_ptr<HideViewAnimationObserver> animation_observer_; | 166 scoped_ptr<HideViewAnimationObserver> animation_observer_; |
150 | 167 |
| 168 // If non-NULL, the app list will remain centered on this screen's primary |
| 169 // display. |
| 170 gfx::Screen* screen_to_keep_centered_on_; |
| 171 |
151 DISALLOW_COPY_AND_ASSIGN(AppListView); | 172 DISALLOW_COPY_AND_ASSIGN(AppListView); |
152 }; | 173 }; |
153 | 174 |
154 } // namespace app_list | 175 } // namespace app_list |
155 | 176 |
156 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 177 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |