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 #include "ash/app_list/app_list_shower_delegate.h" | 5 #include "ash/app_list/app_list_presenter_delegate.h" |
6 | 6 |
7 #include "ash/app_list/app_list_view_delegate_factory.h" | 7 #include "ash/app_list/app_list_view_delegate_factory.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
12 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell_delegate.h" | 14 #include "ash/shell_delegate.h" |
15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "ui/app_list/app_list_constants.h" | 18 #include "ui/app_list/app_list_constants.h" |
19 #include "ui/app_list/app_list_switches.h" | 19 #include "ui/app_list/app_list_switches.h" |
20 #include "ui/app_list/shower/app_list_shower.h" | 20 #include "ui/app_list/presenter/app_list_presenter.h" |
21 #include "ui/app_list/views/app_list_view.h" | 21 #include "ui/app_list/views/app_list_view.h" |
22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
23 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
24 #include "ui/keyboard/keyboard_controller.h" | 24 #include "ui/keyboard/keyboard_controller.h" |
25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
26 | 26 |
27 namespace ash { | 27 namespace ash { |
28 namespace { | 28 namespace { |
29 | 29 |
30 // Offset in pixels to animation away/towards the shelf. | 30 // Offset in pixels to animation away/towards the shelf. |
(...skipping 10 matching lines...) Expand all Loading... |
41 // Gets arrow location based on shelf alignment. | 41 // Gets arrow location based on shelf alignment. |
42 views::BubbleBorder::Arrow GetBubbleArrow(aura::Window* window) { | 42 views::BubbleBorder::Arrow GetBubbleArrow(aura::Window* window) { |
43 DCHECK(Shell::HasInstance()); | 43 DCHECK(Shell::HasInstance()); |
44 return Shelf::ForWindow(window)->SelectValueForShelfAlignment( | 44 return Shelf::ForWindow(window)->SelectValueForShelfAlignment( |
45 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, | 45 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, |
46 views::BubbleBorder::RIGHT_CENTER); | 46 views::BubbleBorder::RIGHT_CENTER); |
47 } | 47 } |
48 | 48 |
49 // Using |button_bounds|, determine the anchor offset so that the bubble gets | 49 // Using |button_bounds|, determine the anchor offset so that the bubble gets |
50 // shown above the shelf (used for the alternate shelf theme). | 50 // shown above the shelf (used for the alternate shelf theme). |
51 gfx::Vector2d GetAnchorPositionOffsetToShelf( | 51 gfx::Vector2d GetAnchorPositionOffsetToShelf(const gfx::Rect& button_bounds, |
52 const gfx::Rect& button_bounds, views::Widget* widget) { | 52 views::Widget* widget) { |
53 DCHECK(Shell::HasInstance()); | 53 DCHECK(Shell::HasInstance()); |
54 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( | 54 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( |
55 widget->GetNativeView()->GetRootWindow()); | 55 widget->GetNativeView()->GetRootWindow()); |
56 gfx::Point anchor(button_bounds.CenterPoint()); | 56 gfx::Point anchor(button_bounds.CenterPoint()); |
57 switch (shelf_alignment) { | 57 switch (shelf_alignment) { |
58 case SHELF_ALIGNMENT_BOTTOM: | 58 case SHELF_ALIGNMENT_BOTTOM: |
59 if (base::i18n::IsRTL()) { | 59 if (base::i18n::IsRTL()) { |
60 int screen_width = widget->GetWorkAreaBoundsInScreen().width(); | 60 int screen_width = widget->GetWorkAreaBoundsInScreen().width(); |
61 return gfx::Vector2d( | 61 return gfx::Vector2d( |
62 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(), | 62 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(), |
63 0), 0); | 63 0), |
| 64 0); |
64 } | 65 } |
65 return gfx::Vector2d( | 66 return gfx::Vector2d( |
66 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0); | 67 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0); |
67 case SHELF_ALIGNMENT_LEFT: | 68 case SHELF_ALIGNMENT_LEFT: |
68 return gfx::Vector2d( | 69 return gfx::Vector2d( |
69 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); | 70 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); |
70 case SHELF_ALIGNMENT_RIGHT: | 71 case SHELF_ALIGNMENT_RIGHT: |
71 return gfx::Vector2d( | 72 return gfx::Vector2d( |
72 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); | 73 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); |
73 } | 74 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 switches::kAshEnableFullscreenAppList) && | 113 switches::kAshEnableFullscreenAppList) && |
113 app_list::switches::IsExperimentalAppListEnabled(); | 114 app_list::switches::IsExperimentalAppListEnabled(); |
114 #else | 115 #else |
115 return false; | 116 return false; |
116 #endif | 117 #endif |
117 } | 118 } |
118 | 119 |
119 } // namespace | 120 } // namespace |
120 | 121 |
121 //////////////////////////////////////////////////////////////////////////////// | 122 //////////////////////////////////////////////////////////////////////////////// |
122 // AppListShowerDelegate, public: | 123 // AppListPresenterDelegate, public: |
123 | 124 |
124 AppListShowerDelegate::AppListShowerDelegate( | 125 AppListPresenterDelegate::AppListPresenterDelegate( |
125 app_list::AppListShower* shower, | 126 app_list::AppListPresenter* presenter, |
126 AppListViewDelegateFactory* view_delegate_factory) | 127 AppListViewDelegateFactory* view_delegate_factory) |
127 : shower_(shower), view_delegate_factory_(view_delegate_factory) { | 128 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { |
128 Shell::GetInstance()->AddShellObserver(this); | 129 Shell::GetInstance()->AddShellObserver(this); |
129 } | 130 } |
130 | 131 |
131 AppListShowerDelegate::~AppListShowerDelegate() { | 132 AppListPresenterDelegate::~AppListPresenterDelegate() { |
132 DCHECK(view_); | 133 DCHECK(view_); |
133 keyboard::KeyboardController* keyboard_controller = | 134 keyboard::KeyboardController* keyboard_controller = |
134 keyboard::KeyboardController::GetInstance(); | 135 keyboard::KeyboardController::GetInstance(); |
135 if (keyboard_controller) | 136 if (keyboard_controller) |
136 keyboard_controller->RemoveObserver(this); | 137 keyboard_controller->RemoveObserver(this); |
137 views::Widget* widget = view_->GetWidget(); | 138 views::Widget* widget = view_->GetWidget(); |
138 Shell::GetInstance()->RemovePreTargetHandler(this); | 139 Shell::GetInstance()->RemovePreTargetHandler(this); |
139 Shelf::ForWindow(widget->GetNativeWindow())->RemoveIconObserver(this); | 140 Shelf::ForWindow(widget->GetNativeWindow())->RemoveIconObserver(this); |
140 Shell::GetInstance()->RemoveShellObserver(this); | 141 Shell::GetInstance()->RemoveShellObserver(this); |
141 } | 142 } |
142 | 143 |
143 app_list::AppListViewDelegate* AppListShowerDelegate::GetViewDelegate() { | 144 app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() { |
144 return view_delegate_factory_->GetDelegate(); | 145 return view_delegate_factory_->GetDelegate(); |
145 } | 146 } |
146 | 147 |
147 void AppListShowerDelegate::Init(app_list::AppListView* view, | 148 void AppListPresenterDelegate::Init(app_list::AppListView* view, |
148 aura::Window* root_window, | 149 aura::Window* root_window, |
149 int current_apps_page) { | 150 int current_apps_page) { |
150 // App list needs to know the new shelf layout in order to calculate its | 151 // App list needs to know the new shelf layout in order to calculate its |
151 // UI layout when AppListView visibility changes. | 152 // UI layout when AppListView visibility changes. |
152 ash::Shell::GetPrimaryRootWindowController() | 153 ash::Shell::GetPrimaryRootWindowController() |
153 ->GetShelfLayoutManager() | 154 ->GetShelfLayoutManager() |
154 ->UpdateAutoHideState(); | 155 ->UpdateAutoHideState(); |
155 view_ = view; | 156 view_ = view; |
156 aura::Window* container = GetRootWindowController(root_window) | 157 aura::Window* container = GetRootWindowController(root_window) |
157 ->GetContainer(kShellWindowId_AppListContainer); | 158 ->GetContainer(kShellWindowId_AppListContainer); |
158 views::View* applist_button = | 159 views::View* applist_button = |
159 Shelf::ForWindow(container)->GetAppListButtonView(); | 160 Shelf::ForWindow(container)->GetAppListButtonView(); |
160 is_centered_ = view->ShouldCenterWindow(); | 161 is_centered_ = view->ShouldCenterWindow(); |
161 bool is_fullscreen = IsFullscreenAppListEnabled() && | 162 bool is_fullscreen = IsFullscreenAppListEnabled() && |
162 Shell::GetInstance() | 163 Shell::GetInstance() |
163 ->maximize_mode_controller() | 164 ->maximize_mode_controller() |
164 ->IsMaximizeModeWindowManagerEnabled(); | 165 ->IsMaximizeModeWindowManagerEnabled(); |
165 if (is_fullscreen) { | 166 if (is_fullscreen) { |
166 view->InitAsFramelessWindow( | 167 view->InitAsFramelessWindow( |
167 container, current_apps_page, | 168 container, current_apps_page, |
168 ScreenUtil::GetDisplayWorkAreaBoundsInParent(container)); | 169 ScreenUtil::GetDisplayWorkAreaBoundsInParent(container)); |
169 } else if (is_centered_) { | 170 } else if (is_centered_) { |
170 // Note: We can't center the app list until we have its dimensions, so we | 171 // Note: We can't center the app list until we have its dimensions, so we |
171 // init at (0, 0) and then reset its anchor point. | 172 // init at (0, 0) and then reset its anchor point. |
172 view->InitAsBubbleAtFixedLocation(container, | 173 view->InitAsBubbleAtFixedLocation(container, current_apps_page, |
173 current_apps_page, | 174 gfx::Point(), views::BubbleBorder::FLOAT, |
174 gfx::Point(), | |
175 views::BubbleBorder::FLOAT, | |
176 true /* border_accepts_events */); | 175 true /* border_accepts_events */); |
177 // The experimental app list is centered over the display of the app list | 176 // The experimental app list is centered over the display of the app list |
178 // button that was pressed (if triggered via keyboard, this is the display | 177 // button that was pressed (if triggered via keyboard, this is the display |
179 // with the currently focused window). | 178 // with the currently focused window). |
180 view->SetAnchorPoint(GetCenterOfDisplayForView( | 179 view->SetAnchorPoint(GetCenterOfDisplayForView( |
181 applist_button, GetMinimumBoundsHeightForAppList(view))); | 180 applist_button, GetMinimumBoundsHeightForAppList(view))); |
182 } else { | 181 } else { |
183 gfx::Rect applist_button_bounds = applist_button->GetBoundsInScreen(); | 182 gfx::Rect applist_button_bounds = applist_button->GetBoundsInScreen(); |
184 // We need the location of the button within the local screen. | 183 // We need the location of the button within the local screen. |
185 applist_button_bounds = ScreenUtil::ConvertRectFromScreen( | 184 applist_button_bounds = |
186 root_window, | 185 ScreenUtil::ConvertRectFromScreen(root_window, applist_button_bounds); |
187 applist_button_bounds); | |
188 view->InitAsBubbleAttachedToAnchor( | 186 view->InitAsBubbleAttachedToAnchor( |
189 container, | 187 container, current_apps_page, |
190 current_apps_page, | |
191 Shelf::ForWindow(container)->GetAppListButtonView(), | 188 Shelf::ForWindow(container)->GetAppListButtonView(), |
192 GetAnchorPositionOffsetToShelf( | 189 GetAnchorPositionOffsetToShelf( |
193 applist_button_bounds, | 190 applist_button_bounds, |
194 Shelf::ForWindow(container)->GetAppListButtonView()->GetWidget()), | 191 Shelf::ForWindow(container)->GetAppListButtonView()->GetWidget()), |
195 GetBubbleArrow(container), | 192 GetBubbleArrow(container), true /* border_accepts_events */); |
196 true /* border_accepts_events */); | |
197 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 193 view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
198 } | 194 } |
199 | 195 |
200 keyboard::KeyboardController* keyboard_controller = | 196 keyboard::KeyboardController* keyboard_controller = |
201 keyboard::KeyboardController::GetInstance(); | 197 keyboard::KeyboardController::GetInstance(); |
202 if (keyboard_controller) | 198 if (keyboard_controller) |
203 keyboard_controller->AddObserver(this); | 199 keyboard_controller->AddObserver(this); |
204 Shell::GetInstance()->AddPreTargetHandler(this); | 200 Shell::GetInstance()->AddPreTargetHandler(this); |
205 views::Widget* widget = view->GetWidget(); | 201 views::Widget* widget = view->GetWidget(); |
206 Shelf::ForWindow(widget->GetNativeWindow())->AddIconObserver(this); | 202 Shelf::ForWindow(widget->GetNativeWindow())->AddIconObserver(this); |
207 | 203 |
208 // By setting us as DnD recipient, the app list knows that we can | 204 // By setting us as DnD recipient, the app list knows that we can |
209 // handle items. | 205 // handle items. |
210 view->SetDragAndDropHostOfCurrentAppList( | 206 view->SetDragAndDropHostOfCurrentAppList( |
211 Shelf::ForWindow(root_window)->GetDragAndDropHostForAppList()); | 207 Shelf::ForWindow(root_window)->GetDragAndDropHostForAppList()); |
212 } | 208 } |
213 | 209 |
214 void AppListShowerDelegate::OnShown(aura::Window* root_window) { | 210 void AppListPresenterDelegate::OnShown(aura::Window* root_window) { |
215 is_visible_ = true; | 211 is_visible_ = true; |
216 // Update applist button status when app list visibility is changed. | 212 // Update applist button status when app list visibility is changed. |
217 Shelf::ForWindow(root_window)->GetAppListButtonView()->SchedulePaint(); | 213 Shelf::ForWindow(root_window)->GetAppListButtonView()->SchedulePaint(); |
218 } | 214 } |
219 | 215 |
220 void AppListShowerDelegate::OnDismissed() { | 216 void AppListPresenterDelegate::OnDismissed() { |
221 DCHECK(is_visible_); | 217 DCHECK(is_visible_); |
222 DCHECK(view_); | 218 DCHECK(view_); |
223 | 219 |
224 is_visible_ = false; | 220 is_visible_ = false; |
225 | 221 |
226 // App list needs to know the new shelf layout in order to calculate its | 222 // App list needs to know the new shelf layout in order to calculate its |
227 // UI layout when AppListView visibility changes. | 223 // UI layout when AppListView visibility changes. |
228 Shell::GetPrimaryRootWindowController() | 224 Shell::GetPrimaryRootWindowController() |
229 ->GetShelfLayoutManager() | 225 ->GetShelfLayoutManager() |
230 ->UpdateAutoHideState(); | 226 ->UpdateAutoHideState(); |
231 | 227 |
232 // Update applist button status when app list visibility is changed. | 228 // Update applist button status when app list visibility is changed. |
233 Shelf::ForWindow(view_->GetWidget()->GetNativeView()) | 229 Shelf::ForWindow(view_->GetWidget()->GetNativeView()) |
234 ->GetAppListButtonView() | 230 ->GetAppListButtonView() |
235 ->SchedulePaint(); | 231 ->SchedulePaint(); |
236 } | 232 } |
237 | 233 |
238 void AppListShowerDelegate::UpdateBounds() { | 234 void AppListPresenterDelegate::UpdateBounds() { |
239 if (!view_ || !is_visible_) | 235 if (!view_ || !is_visible_) |
240 return; | 236 return; |
241 | 237 |
242 view_->UpdateBounds(); | 238 view_->UpdateBounds(); |
243 | 239 |
244 if (is_centered_) { | 240 if (is_centered_) { |
245 view_->SetAnchorPoint(GetCenterOfDisplayForView( | 241 view_->SetAnchorPoint(GetCenterOfDisplayForView( |
246 view_, GetMinimumBoundsHeightForAppList(view_))); | 242 view_, GetMinimumBoundsHeightForAppList(view_))); |
247 } | 243 } |
248 } | 244 } |
249 | 245 |
250 gfx::Vector2d AppListShowerDelegate::GetVisibilityAnimationOffset( | 246 gfx::Vector2d AppListPresenterDelegate::GetVisibilityAnimationOffset( |
251 aura::Window* root_window) { | 247 aura::Window* root_window) { |
252 DCHECK(Shell::HasInstance()); | 248 DCHECK(Shell::HasInstance()); |
253 | 249 |
254 // App list needs to know the new shelf layout in order to calculate its | 250 // App list needs to know the new shelf layout in order to calculate its |
255 // UI layout when AppListView visibility changes. | 251 // UI layout when AppListView visibility changes. |
256 Shell::GetPrimaryRootWindowController() | 252 Shell::GetPrimaryRootWindowController() |
257 ->GetShelfLayoutManager() | 253 ->GetShelfLayoutManager() |
258 ->UpdateAutoHideState(); | 254 ->UpdateAutoHideState(); |
259 | 255 |
260 ShelfAlignment shelf_alignment = | 256 ShelfAlignment shelf_alignment = |
261 Shell::GetInstance()->GetShelfAlignment(root_window); | 257 Shell::GetInstance()->GetShelfAlignment(root_window); |
262 switch (shelf_alignment) { | 258 switch (shelf_alignment) { |
263 case SHELF_ALIGNMENT_BOTTOM: | 259 case SHELF_ALIGNMENT_BOTTOM: |
264 return gfx::Vector2d(0, kAnimationOffset); | 260 return gfx::Vector2d(0, kAnimationOffset); |
265 case SHELF_ALIGNMENT_LEFT: | 261 case SHELF_ALIGNMENT_LEFT: |
266 return gfx::Vector2d(-kAnimationOffset, 0); | 262 return gfx::Vector2d(-kAnimationOffset, 0); |
267 case SHELF_ALIGNMENT_RIGHT: | 263 case SHELF_ALIGNMENT_RIGHT: |
268 return gfx::Vector2d(kAnimationOffset, 0); | 264 return gfx::Vector2d(kAnimationOffset, 0); |
269 } | 265 } |
270 NOTREACHED(); | 266 NOTREACHED(); |
271 return gfx::Vector2d(); | 267 return gfx::Vector2d(); |
272 } | 268 } |
273 | 269 |
274 //////////////////////////////////////////////////////////////////////////////// | 270 //////////////////////////////////////////////////////////////////////////////// |
275 // AppListShowerDelegate, private: | 271 // AppListPresenterDelegate, private: |
276 | 272 |
277 void AppListShowerDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { | 273 void AppListPresenterDelegate::ProcessLocatedEvent(ui::LocatedEvent* event) { |
278 if (!view_ || !is_visible_) | 274 if (!view_ || !is_visible_) |
279 return; | 275 return; |
280 | 276 |
281 // If the event happened on a menu, then the event should not close the app | 277 // If the event happened on a menu, then the event should not close the app |
282 // list. | 278 // list. |
283 aura::Window* target = static_cast<aura::Window*>(event->target()); | 279 aura::Window* target = static_cast<aura::Window*>(event->target()); |
284 if (target) { | 280 if (target) { |
285 RootWindowController* root_controller = | 281 RootWindowController* root_controller = |
286 GetRootWindowController(target->GetRootWindow()); | 282 GetRootWindowController(target->GetRootWindow()); |
287 if (root_controller) { | 283 if (root_controller) { |
288 aura::Window* menu_container = | 284 aura::Window* menu_container = |
289 root_controller->GetContainer(kShellWindowId_MenuContainer); | 285 root_controller->GetContainer(kShellWindowId_MenuContainer); |
290 if (menu_container->Contains(target)) | 286 if (menu_container->Contains(target)) |
291 return; | 287 return; |
292 aura::Window* keyboard_container = root_controller->GetContainer( | 288 aura::Window* keyboard_container = root_controller->GetContainer( |
293 kShellWindowId_VirtualKeyboardContainer); | 289 kShellWindowId_VirtualKeyboardContainer); |
294 if (keyboard_container->Contains(target)) | 290 if (keyboard_container->Contains(target)) |
295 return; | 291 return; |
296 } | 292 } |
297 } | 293 } |
298 | 294 |
299 aura::Window* window = view_->GetWidget()->GetNativeView()->parent(); | 295 aura::Window* window = view_->GetWidget()->GetNativeView()->parent(); |
300 if (!window->Contains(target) && | 296 if (!window->Contains(target) && |
301 !app_list::switches::ShouldNotDismissOnBlur()) { | 297 !app_list::switches::ShouldNotDismissOnBlur()) { |
302 shower_->Dismiss(); | 298 presenter_->Dismiss(); |
303 } | 299 } |
304 } | 300 } |
305 | 301 |
306 //////////////////////////////////////////////////////////////////////////////// | 302 //////////////////////////////////////////////////////////////////////////////// |
307 // AppListShowerDelegate, aura::EventFilter implementation: | 303 // AppListPresenterDelegate, aura::EventFilter implementation: |
308 | 304 |
309 void AppListShowerDelegate::OnMouseEvent(ui::MouseEvent* event) { | 305 void AppListPresenterDelegate::OnMouseEvent(ui::MouseEvent* event) { |
310 if (event->type() == ui::ET_MOUSE_PRESSED) | 306 if (event->type() == ui::ET_MOUSE_PRESSED) |
311 ProcessLocatedEvent(event); | 307 ProcessLocatedEvent(event); |
312 } | 308 } |
313 | 309 |
314 void AppListShowerDelegate::OnGestureEvent(ui::GestureEvent* event) { | 310 void AppListPresenterDelegate::OnGestureEvent(ui::GestureEvent* event) { |
315 if (event->type() == ui::ET_GESTURE_TAP_DOWN) | 311 if (event->type() == ui::ET_GESTURE_TAP_DOWN) |
316 ProcessLocatedEvent(event); | 312 ProcessLocatedEvent(event); |
317 } | 313 } |
318 | 314 |
319 //////////////////////////////////////////////////////////////////////////////// | 315 //////////////////////////////////////////////////////////////////////////////// |
320 // AppListShowerDelegate, keyboard::KeyboardControllerObserver implementation: | 316 // AppListPresenterDelegate, keyboard::KeyboardControllerObserver |
| 317 // implementation: |
321 | 318 |
322 void AppListShowerDelegate::OnKeyboardBoundsChanging( | 319 void AppListPresenterDelegate::OnKeyboardBoundsChanging( |
323 const gfx::Rect& new_bounds) { | 320 const gfx::Rect& new_bounds) { |
324 UpdateBounds(); | 321 UpdateBounds(); |
325 } | 322 } |
326 | 323 |
327 //////////////////////////////////////////////////////////////////////////////// | 324 //////////////////////////////////////////////////////////////////////////////// |
328 // AppListShowerDelegate, ShellObserver implementation: | 325 // AppListPresenterDelegate, ShellObserver implementation: |
329 void AppListShowerDelegate::OnShelfAlignmentChanged(aura::Window* root_window) { | 326 void AppListPresenterDelegate::OnShelfAlignmentChanged( |
| 327 aura::Window* root_window) { |
330 if (view_) | 328 if (view_) |
331 view_->SetBubbleArrow(GetBubbleArrow(view_->GetWidget()->GetNativeView())); | 329 view_->SetBubbleArrow(GetBubbleArrow(view_->GetWidget()->GetNativeView())); |
332 } | 330 } |
333 | 331 |
334 void AppListShowerDelegate::OnMaximizeModeStarted() { | 332 void AppListPresenterDelegate::OnMaximizeModeStarted() { |
335 // The "fullscreen" app-list is initialized as in a different type of window, | 333 // The "fullscreen" app-list is initialized as in a different type of window, |
336 // therefore we can't switch between the fullscreen status and the normal | 334 // therefore we can't switch between the fullscreen status and the normal |
337 // app-list bubble. App-list should be dismissed for the transition between | 335 // app-list bubble. App-list should be dismissed for the transition between |
338 // maximize mode (touch-view mode) and non-maximize mode, otherwise the app | 336 // maximize mode (touch-view mode) and non-maximize mode, otherwise the app |
339 // list tries to behave as a bubble which leads to a crash. crbug.com/510062 | 337 // list tries to behave as a bubble which leads to a crash. crbug.com/510062 |
340 if (IsFullscreenAppListEnabled() && is_visible_) | 338 if (IsFullscreenAppListEnabled() && is_visible_) |
341 shower_->Dismiss(); | 339 presenter_->Dismiss(); |
342 } | 340 } |
343 | 341 |
344 void AppListShowerDelegate::OnMaximizeModeEnded() { | 342 void AppListPresenterDelegate::OnMaximizeModeEnded() { |
345 // See the comments of OnMaximizeModeStarted(). | 343 // See the comments of OnMaximizeModeStarted(). |
346 if (IsFullscreenAppListEnabled() && is_visible_) | 344 if (IsFullscreenAppListEnabled() && is_visible_) |
347 shower_->Dismiss(); | 345 presenter_->Dismiss(); |
348 } | 346 } |
349 | 347 |
350 //////////////////////////////////////////////////////////////////////////////// | 348 //////////////////////////////////////////////////////////////////////////////// |
351 // AppListShowerDelegate, ShelfIconObserver implementation: | 349 // AppListPresenterDelegate, ShelfIconObserver implementation: |
352 | 350 |
353 void AppListShowerDelegate::OnShelfIconPositionsChanged() { | 351 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { |
354 UpdateBounds(); | 352 UpdateBounds(); |
355 } | 353 } |
356 | 354 |
357 } // namespace ash | 355 } // namespace ash |
OLD | NEW |