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

Side by Side Diff: ash/display/screen_position_controller.cc

Issue 10911342: Add ScreenPositionClient::ConvertNativePointToScreen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 "ash/display/screen_position_controller.h" 5 #include "ash/display/screen_position_controller.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/coordinate_conversion.h"
11 #include "ash/wm/system_modal_container_layout_manager.h" 12 #include "ash/wm/system_modal_container_layout_manager.h"
12 #include "ash/wm/window_properties.h" 13 #include "ash/wm/window_properties.h"
13 #include "ash/wm/workspace_controller.h" 14 #include "ash/wm/workspace_controller.h"
14 #include "ui/aura/client/activation_client.h" 15 #include "ui/aura/client/activation_client.h"
15 #include "ui/aura/client/capture_client.h" 16 #include "ui/aura/client/capture_client.h"
16 #include "ui/aura/client/stacking_client.h" 17 #include "ui/aura/client/stacking_client.h"
17 #include "ui/aura/focus_manager.h" 18 #include "ui/aura/focus_manager.h"
18 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
19 #include "ui/aura/window_tracker.h" 20 #include "ui/aura/window_tracker.h"
20 #include "ui/gfx/display.h" 21 #include "ui/gfx/display.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const aura::Window* window, 70 const aura::Window* window,
70 gfx::Point* point) { 71 gfx::Point* point) {
71 const aura::RootWindow* root = window->GetRootWindow(); 72 const aura::RootWindow* root = window->GetRootWindow();
72 const gfx::Point display_origin = 73 const gfx::Point display_origin =
73 gfx::Screen::GetDisplayNearestWindow( 74 gfx::Screen::GetDisplayNearestWindow(
74 const_cast<aura::RootWindow*>(root)).bounds().origin(); 75 const_cast<aura::RootWindow*>(root)).bounds().origin();
75 point->Offset(-display_origin.x(), -display_origin.y()); 76 point->Offset(-display_origin.x(), -display_origin.y());
76 aura::Window::ConvertPointToTarget(root, window, point); 77 aura::Window::ConvertPointToTarget(root, window, point);
77 } 78 }
78 79
80 void ScreenPositionController::ConvertNativePointToScreen(
81 aura::Window* window,
82 gfx::Point* point) {
83 std::pair<aura::RootWindow*, gfx::Point> pair =
84 wm::GetRootWindowRelativeToWindow(window, *point);
oshima 2012/09/19 01:46:27 Please move GetRootWindowRelativeToWindow to this
mazda 2012/09/19 02:06:56 Sure, I will.
85 *point = pair.second;
86 ConvertPointToScreen(pair.first, point);
87 }
88
79 void ScreenPositionController::SetBounds(aura::Window* window, 89 void ScreenPositionController::SetBounds(aura::Window* window,
80 const gfx::Rect& bounds, 90 const gfx::Rect& bounds,
81 const gfx::Display& display) { 91 const gfx::Display& display) {
82 DCHECK_NE(-1, display.id()); 92 DCHECK_NE(-1, display.id());
83 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { 93 if (!window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) {
84 window->SetBounds(bounds); 94 window->SetBounds(bounds);
85 return; 95 return;
86 } 96 }
87 97
88 // Don't move a transient windows to other root window. 98 // Don't move a transient windows to other root window.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 144
135 gfx::Point origin(bounds.origin()); 145 gfx::Point origin(bounds.origin());
136 const gfx::Point display_origin = 146 const gfx::Point display_origin =
137 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); 147 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin();
138 origin.Offset(-display_origin.x(), -display_origin.y()); 148 origin.Offset(-display_origin.x(), -display_origin.y());
139 window->SetBounds(gfx::Rect(origin, bounds.size())); 149 window->SetBounds(gfx::Rect(origin, bounds.size()));
140 } 150 }
141 151
142 } // internal 152 } // internal
143 } // ash 153 } // ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698