Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: trunk/src/ui/views/widget/desktop_aura/desktop_screen_position_client.cc

Issue 22356003: Revert 215772 "Don't assume that widgets of TYPE_CONTROL are par..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/ui/views/widget/desktop_aura/desktop_screen_position_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/root_window.h" 7 #include "ui/aura/root_window.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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void DesktopScreenPositionClient::ConvertHostPointToScreen( 61 void DesktopScreenPositionClient::ConvertHostPointToScreen(
62 aura::RootWindow* window, gfx::Point* point) { 62 aura::RootWindow* window, gfx::Point* point) {
63 ConvertPointToScreen(window, point); 63 ConvertPointToScreen(window, point);
64 } 64 }
65 65
66 void DesktopScreenPositionClient::SetBounds( 66 void DesktopScreenPositionClient::SetBounds(
67 aura::Window* window, 67 aura::Window* window,
68 const gfx::Rect& bounds, 68 const gfx::Rect& bounds,
69 const gfx::Display& display) { 69 const gfx::Display& display) {
70 // TODO: Use the 3rd parameter, |display|. 70 // TODO: Use the 3rd parameter, |display|.
71 gfx::Point origin = bounds.origin();
71 aura::RootWindow* root = window->GetRootWindow(); 72 aura::RootWindow* root = window->GetRootWindow();
73 aura::Window::ConvertPointToTarget(window->parent(), root, &origin);
74
75 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) {
76 window->SetBounds(gfx::Rect(origin, bounds.size()));
77 return;
78 }
72 79
73 if (PositionWindowInScreenCoordinates(window)) { 80 if (PositionWindowInScreenCoordinates(window)) {
74 // The caller expects windows we consider "embedded" to be placed in the 81 // The caller expects windows we consider "embedded" to be placed in the
75 // screen coordinate system. So we need to offset the root window's 82 // screen coordinate system. So we need to offset the root window's
76 // position (which is in screen coordinates) from these bounds. 83 // position (which is in screen coordinates) from these bounds.
77
78 gfx::Point origin = bounds.origin();
79 aura::Window::ConvertPointToTarget(window->parent(), root, &origin);
80
81 gfx::Point host_origin = GetOrigin(root); 84 gfx::Point host_origin = GetOrigin(root);
82 origin.Offset(-host_origin.x(), -host_origin.y()); 85 origin.Offset(-host_origin.x(), -host_origin.y());
83 window->SetBounds(gfx::Rect(origin, bounds.size())); 86 window->SetBounds(gfx::Rect(origin, bounds.size()));
84 return; 87 return;
85 } 88 }
86 89
87 DesktopNativeWidgetAura* desktop_native_widget = 90 DesktopNativeWidgetAura* desktop_native_widget =
88 DesktopNativeWidgetAura::ForWindow(window); 91 DesktopNativeWidgetAura::ForWindow(window);
89 if (desktop_native_widget) { 92 if (desktop_native_widget) {
90 root->SetHostBounds(bounds); 93 root->SetHostBounds(bounds);
91 // Setting bounds of root resizes |window|. 94 // Setting bounds of root resizes |window|.
92 } else { 95 } else {
93 window->SetBounds(bounds); 96 window->SetBounds(bounds);
94 } 97 }
95 } 98 }
96 99
97 } // namespace views 100 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | trunk/src/ui/views/widget/desktop_aura/desktop_screen_position_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698