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_presenter_delegate.h" | 5 #include "ash/app_list/app_list_presenter_delegate.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/public/cpp/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
12 #include "ash/shelf/app_list_button.h" | 12 #include "ash/shelf/app_list_button.h" |
13 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
14 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
15 #include "ash/shelf/wm_shelf.h" | 15 #include "ash/shelf/wm_shelf.h" |
16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
17 #include "ash/shell_port.h" | 17 #include "ash/shell_port.h" |
18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
19 #include "ash/wm/wm_screen_util.h" | |
20 #include "ash/wm_window.h" | 19 #include "ash/wm_window.h" |
21 #include "base/command_line.h" | 20 #include "base/command_line.h" |
22 #include "ui/app_list/app_list_constants.h" | 21 #include "ui/app_list/app_list_constants.h" |
23 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
24 #include "ui/app_list/presenter/app_list_presenter_impl.h" | 23 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
25 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" | 24 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" |
26 #include "ui/app_list/views/app_list_view.h" | 25 #include "ui/app_list/views/app_list_view.h" |
27 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
28 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
29 #include "ui/keyboard/keyboard_controller.h" | 28 #include "ui/keyboard/keyboard_controller.h" |
30 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
31 | 30 |
32 namespace ash { | 31 namespace ash { |
33 namespace { | 32 namespace { |
34 | 33 |
35 // Gets the point at the center of the display containing the given |window|. | 34 // Gets the point at the center of the display containing the given |window|. |
36 // This calculation excludes the virtual keyboard area. If the height of the | 35 // This calculation excludes the virtual keyboard area. If the height of the |
37 // display area is less than |minimum_height|, its bottom will be extended to | 36 // display area is less than |minimum_height|, its bottom will be extended to |
38 // that height (so that the app list never starts above the top of the screen). | 37 // that height (so that the app list never starts above the top of the screen). |
39 gfx::Point GetCenterOfDisplayForWindow(WmWindow* window, int minimum_height) { | 38 gfx::Point GetCenterOfDisplayForWindow(WmWindow* window, int minimum_height) { |
40 DCHECK(window); | 39 DCHECK(window); |
41 gfx::Rect bounds = wm::GetDisplayBoundsWithShelf(window); | 40 gfx::Rect bounds = |
| 41 ScreenUtil::GetDisplayBoundsWithShelf(window->aura_window()); |
42 bounds = window->GetRootWindow()->ConvertRectToScreen(bounds); | 42 bounds = window->GetRootWindow()->ConvertRectToScreen(bounds); |
43 | 43 |
44 // If the virtual keyboard is active, subtract it from the display bounds, so | 44 // If the virtual keyboard is active, subtract it from the display bounds, so |
45 // that the app list is centered in the non-keyboard area of the display. | 45 // that the app list is centered in the non-keyboard area of the display. |
46 // (Note that work_area excludes the keyboard, but it doesn't get updated | 46 // (Note that work_area excludes the keyboard, but it doesn't get updated |
47 // until after this function is called.) | 47 // until after this function is called.) |
48 keyboard::KeyboardController* keyboard_controller = | 48 keyboard::KeyboardController* keyboard_controller = |
49 keyboard::KeyboardController::GetInstance(); | 49 keyboard::KeyboardController::GetInstance(); |
50 if (keyboard_controller && keyboard_controller->keyboard_visible()) | 50 if (keyboard_controller && keyboard_controller->keyboard_visible()) |
51 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); | 51 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 //////////////////////////////////////////////////////////////////////////////// | 243 //////////////////////////////////////////////////////////////////////////////// |
244 // AppListPresenterDelegate, WmShelfObserver implementation: | 244 // AppListPresenterDelegate, WmShelfObserver implementation: |
245 | 245 |
246 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 246 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { |
247 UpdateBounds(); | 247 UpdateBounds(); |
248 } | 248 } |
249 | 249 |
250 } // namespace ash | 250 } // namespace ash |
OLD | NEW |