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

Side by Side Diff: ui/views/widget/desktop_screen_position_client.cc

Issue 10911342: Add ScreenPositionClient::ConvertNativePointToScreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 | « ui/views/widget/desktop_screen_position_client.h ('k') | no next file » | 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_screen_position_client.h" 5 #include "ui/views/widget/desktop_screen_position_client.h"
6 6
7 #include "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 8
9 namespace views { 9 namespace views {
10 10
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 void DesktopScreenPositionClient::ConvertPointFromScreen( 25 void DesktopScreenPositionClient::ConvertPointFromScreen(
26 const aura::Window* window, gfx::Point* point) { 26 const aura::Window* window, gfx::Point* point) {
27 const aura::RootWindow* root_window = window->GetRootWindow(); 27 const aura::RootWindow* root_window = window->GetRootWindow();
28 gfx::Point origin = root_window->GetHostOrigin(); 28 gfx::Point origin = root_window->GetHostOrigin();
29 point->Offset(-origin.x(), -origin.y()); 29 point->Offset(-origin.x(), -origin.y());
30 aura::Window::ConvertPointToTarget(root_window, window, point); 30 aura::Window::ConvertPointToTarget(root_window, window, point);
31 } 31 }
32 32
33 void DesktopScreenPositionClient::ConvertNativePointToScreen(
34 aura::Window* window, gfx::Point* point) {
35 ConvertPointToScreen(window, point);
36 }
37
33 void DesktopScreenPositionClient::SetBounds( 38 void DesktopScreenPositionClient::SetBounds(
34 aura::Window* window, 39 aura::Window* window,
35 const gfx::Rect& bounds, 40 const gfx::Rect& bounds,
36 const gfx::Display& display) { 41 const gfx::Display& display) {
37 // TODO: Use the 3rd parameter, |display|. 42 // TODO: Use the 3rd parameter, |display|.
38 gfx::Point origin = bounds.origin(); 43 gfx::Point origin = bounds.origin();
39 aura::RootWindow* root = window->GetRootWindow(); 44 aura::RootWindow* root = window->GetRootWindow();
40 aura::Window::ConvertPointToTarget(window->parent(), root, &origin); 45 aura::Window::ConvertPointToTarget(window->parent(), root, &origin);
41 46
42 #if !defined(OS_WIN) 47 #if !defined(OS_WIN)
43 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) { 48 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) {
44 window->SetBounds(gfx::Rect(origin, bounds.size())); 49 window->SetBounds(gfx::Rect(origin, bounds.size()));
45 return; 50 return;
46 } else if (window->type() == aura::client::WINDOW_TYPE_POPUP) { 51 } else if (window->type() == aura::client::WINDOW_TYPE_POPUP) {
47 // The caller expects windows we consider "embedded" to be placed in the 52 // The caller expects windows we consider "embedded" to be placed in the
48 // screen coordinate system. So we need to offset the root window's 53 // screen coordinate system. So we need to offset the root window's
49 // position (which is in screen coordinates) from these bounds. 54 // position (which is in screen coordinates) from these bounds.
50 gfx::Point host_origin = root->GetHostOrigin(); 55 gfx::Point host_origin = root->GetHostOrigin();
51 origin.Offset(-host_origin.x(), -host_origin.y()); 56 origin.Offset(-host_origin.x(), -host_origin.y());
52 window->SetBounds(gfx::Rect(origin, bounds.size())); 57 window->SetBounds(gfx::Rect(origin, bounds.size()));
53 return; 58 return;
54 } 59 }
55 #endif // !defined(OS_WIN) 60 #endif // !defined(OS_WIN)
56 } 61 }
57 62
58 } // namespace views 63 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_screen_position_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698