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 "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
6 | 6 |
7 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 7 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
8 | 8 |
9 namespace views { | 9 namespace views { |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // TODO(jam): Use the 3rd parameter, |display|. | 38 // TODO(jam): Use the 3rd parameter, |display|. |
39 aura::Window* root = window->GetRootWindow(); | 39 aura::Window* root = window->GetRootWindow(); |
40 | 40 |
41 // This method assumes that |window| does not have an associated | 41 // This method assumes that |window| does not have an associated |
42 // DesktopNativeWidgetAura. | 42 // DesktopNativeWidgetAura. |
43 internal::NativeWidgetPrivate* desktop_native_widget = | 43 internal::NativeWidgetPrivate* desktop_native_widget = |
44 DesktopNativeWidgetAura::ForWindow(root); | 44 DesktopNativeWidgetAura::ForWindow(root); |
45 DCHECK(!desktop_native_widget || | 45 DCHECK(!desktop_native_widget || |
46 desktop_native_widget->GetNativeView() != window); | 46 desktop_native_widget->GetNativeView() != window); |
47 | 47 |
| 48 if (window->IsRootWindow()) { |
| 49 desktop_native_widget->GetWidget()->SetBounds(bounds); |
| 50 return; |
| 51 } |
| 52 |
48 if (PositionWindowInScreenCoordinates(window)) { | 53 if (PositionWindowInScreenCoordinates(window)) { |
49 // The caller expects windows we consider "embedded" to be placed in the | 54 // The caller expects windows we consider "embedded" to be placed in the |
50 // screen coordinate system. So we need to offset the root window's | 55 // screen coordinate system. So we need to offset the root window's |
51 // position (which is in screen coordinates) from these bounds. | 56 // position (which is in screen coordinates) from these bounds. |
52 | 57 |
53 gfx::Point origin = bounds.origin(); | 58 gfx::Point origin = bounds.origin(); |
54 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); | 59 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); |
55 | 60 |
56 gfx::Point host_origin = GetOriginInScreen(root); | 61 gfx::Point host_origin = GetOriginInScreen(root); |
57 origin.Offset(-host_origin.x(), -host_origin.y()); | 62 origin.Offset(-host_origin.x(), -host_origin.y()); |
58 window->SetBounds(gfx::Rect(origin, bounds.size())); | 63 window->SetBounds(gfx::Rect(origin, bounds.size())); |
59 return; | 64 return; |
60 } | 65 } |
61 | 66 |
62 window->SetBounds(bounds); | 67 window->SetBounds(bounds); |
63 } | 68 } |
64 | 69 |
65 } // namespace views | 70 } // namespace views |
OLD | NEW |