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/wm/app_list_controller.h" | 5 #include "ash/wm/app_list_controller.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return gfx::Vector2d(); | 117 return gfx::Vector2d(); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 // Gets the point at the center of the display that a particular view is on. | 121 // Gets the point at the center of the display that a particular view is on. |
122 // This calculation excludes the virtual keyboard area. If the height of the | 122 // This calculation excludes the virtual keyboard area. If the height of the |
123 // display area is less than |minimum_height|, its bottom will be extended to | 123 // display area is less than |minimum_height|, its bottom will be extended to |
124 // that height (so that the app list never starts above the top of the screen). | 124 // that height (so that the app list never starts above the top of the screen). |
125 gfx::Point GetCenterOfDisplayForView(const views::View* view, | 125 gfx::Point GetCenterOfDisplayForView(const views::View* view, |
126 int minimum_height) { | 126 int minimum_height) { |
127 gfx::Rect bounds = Shell::GetScreen()->GetDisplayNearestWindow( | 127 aura::Window* window = view->GetWidget()->GetNativeView(); |
128 view->GetWidget()->GetNativeView()).bounds(); | 128 gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInScreen(window); |
129 | 129 |
130 // If the virtual keyboard is active, subtract it from the display bounds, so | 130 // If the virtual keyboard is active, subtract it from the display bounds, so |
131 // that the app list is centered in the non-keyboard area of the display. | 131 // that the app list is centered in the non-keyboard area of the display. |
132 // (Note that work_area excludes the keyboard, but it doesn't get updated | 132 // (Note that work_area excludes the keyboard, but it doesn't get updated |
133 // until after this function is called.) | 133 // until after this function is called.) |
134 keyboard::KeyboardController* keyboard_controller = | 134 keyboard::KeyboardController* keyboard_controller = |
135 keyboard::KeyboardController::GetInstance(); | 135 keyboard::KeyboardController::GetInstance(); |
136 if (keyboard_controller && keyboard_controller->keyboard_visible()) | 136 if (keyboard_controller && keyboard_controller->keyboard_visible()) |
137 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); | 137 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); |
138 | 138 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } else if (should_snap_back_) { | 534 } else if (should_snap_back_) { |
535 should_snap_back_ = false; | 535 should_snap_back_ = false; |
536 ui::ScopedLayerAnimationSettings animation(widget_animator); | 536 ui::ScopedLayerAnimationSettings animation(widget_animator); |
537 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 537 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
538 app_list::kOverscrollPageTransitionDurationMs)); | 538 app_list::kOverscrollPageTransitionDurationMs)); |
539 widget->SetBounds(view_bounds_); | 539 widget->SetBounds(view_bounds_); |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 } // namespace ash | 543 } // namespace ash |
OLD | NEW |