Chromium Code Reviews| 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/aura/window_tree_host.h" | 7 #include "ui/aura/window_tree_host.h" |
| 8 #include "ui/gfx/display.h" | 8 #include "ui/gfx/display.h" |
| 9 #include "ui/gfx/point_conversions.h" | 9 #include "ui/gfx/point_conversions.h" |
| 10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
| 11 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | |
| 12 | 11 |
| 13 namespace views { | 12 namespace views { |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 gfx::Point GetOrigin(const aura::Window* root_window) { | 16 gfx::Point GetOrigin(const aura::Window* root_window) { |
| 18 gfx::Point origin_in_pixels = | 17 gfx::Point origin_in_pixels = |
| 19 root_window->GetHost()->GetBounds().origin(); | 18 root_window->GetHost()->GetBounds().origin(); |
| 20 aura::Window* window = const_cast<aura::Window*>(root_window); | 19 aura::Window* window = const_cast<aura::Window*>(root_window); |
| 21 float scale = gfx::Screen::GetScreenFor(window)-> | 20 float scale = gfx::Screen::GetScreenFor(window)-> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 81 |
| 83 gfx::Point origin = bounds.origin(); | 82 gfx::Point origin = bounds.origin(); |
| 84 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); | 83 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); |
| 85 | 84 |
| 86 gfx::Point host_origin = GetOrigin(root); | 85 gfx::Point host_origin = GetOrigin(root); |
| 87 origin.Offset(-host_origin.x(), -host_origin.y()); | 86 origin.Offset(-host_origin.x(), -host_origin.y()); |
| 88 window->SetBounds(gfx::Rect(origin, bounds.size())); | 87 window->SetBounds(gfx::Rect(origin, bounds.size())); |
| 89 return; | 88 return; |
| 90 } | 89 } |
| 91 | 90 |
| 92 internal::NativeWidgetPrivate* desktop_native_widget = | 91 window->SetBounds(bounds); |
| 93 DesktopNativeWidgetAura::ForWindow(root); | |
| 94 if (desktop_native_widget && | |
|
sadrul
2014/05/20 17:39:17
Is this because DesktopNativeWidgetAura::ForWindow
pkotwicz
2014/05/20 19:11:13
views::Widget::is_top_level() returns true if
sadrul
2014/05/20 20:03:10
OK. Let's add DCHECK() for this, so we know to fix
pkotwicz
2014/05/20 21:27:25
There is no point in a DCHECK. One could argue tha
sadrul
2014/05/21 19:00:06
Right. Do we have code to check that that call is
| |
| 95 desktop_native_widget->GetNativeView() == window) { | |
| 96 // |window| is the content_window. | |
| 97 // Setting bounds of root resizes |window|. | |
| 98 root->GetHost()->SetBounds(bounds); | |
| 99 } else { | |
| 100 window->SetBounds(bounds); | |
| 101 } | |
| 102 } | 92 } |
| 103 | 93 |
| 104 } // namespace views | 94 } // namespace views |
| OLD | NEW |