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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } // namespace 55 } // namespace
56 56
57 namespace internal { 57 namespace internal {
58 58
59 void ScreenPositionController::ConvertPointToScreen( 59 void ScreenPositionController::ConvertPointToScreen(
60 const aura::Window* window, 60 const aura::Window* window,
61 gfx::Point* point) { 61 gfx::Point* point) {
62 const aura::RootWindow* root = window->GetRootWindow(); 62 const aura::RootWindow* root = window->GetRootWindow();
63 aura::Window::ConvertPointToTarget(window, root, point); 63 aura::Window::ConvertPointToTarget(window, root, point);
64 const gfx::Point display_origin = 64 const gfx::Point display_origin =
65 gfx::Screen::GetDisplayNearestWindow( 65 Shell::GetAshScreen()->GetDisplayNearestWindow(
66 const_cast<aura::RootWindow*>(root)).bounds().origin(); 66 const_cast<aura::RootWindow*>(root)).bounds().origin();
67 point->Offset(display_origin.x(), display_origin.y()); 67 point->Offset(display_origin.x(), display_origin.y());
68 } 68 }
69 69
70 void ScreenPositionController::ConvertPointFromScreen( 70 void ScreenPositionController::ConvertPointFromScreen(
71 const aura::Window* window, 71 const aura::Window* window,
72 gfx::Point* point) { 72 gfx::Point* point) {
73 const aura::RootWindow* root = window->GetRootWindow(); 73 const aura::RootWindow* root = window->GetRootWindow();
74 const gfx::Point display_origin = 74 const gfx::Point display_origin =
75 gfx::Screen::GetDisplayNearestWindow( 75 Shell::GetAshScreen()->GetDisplayNearestWindow(
76 const_cast<aura::RootWindow*>(root)).bounds().origin(); 76 const_cast<aura::RootWindow*>(root)).bounds().origin();
77 point->Offset(-display_origin.x(), -display_origin.y()); 77 point->Offset(-display_origin.x(), -display_origin.y());
78 aura::Window::ConvertPointToTarget(root, window, point); 78 aura::Window::ConvertPointToTarget(root, window, point);
79 } 79 }
80 80
81 void ScreenPositionController::ConvertNativePointToScreen( 81 void ScreenPositionController::ConvertNativePointToScreen(
82 aura::Window* window, 82 aura::Window* window,
83 gfx::Point* point) { 83 gfx::Point* point) {
84 std::pair<aura::RootWindow*, gfx::Point> pair = 84 std::pair<aura::RootWindow*, gfx::Point> pair =
85 wm::GetRootWindowRelativeToWindow( 85 wm::GetRootWindowRelativeToWindow(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 // Restore focused/active window. 144 // Restore focused/active window.
145 if (tracker.Contains(focused)) 145 if (tracker.Contains(focused))
146 window->GetFocusManager()->SetFocusedWindow(focused, NULL); 146 window->GetFocusManager()->SetFocusedWindow(focused, NULL);
147 else if (tracker.Contains(active)) 147 else if (tracker.Contains(active))
148 activation_client->ActivateWindow(active); 148 activation_client->ActivateWindow(active);
149 } 149 }
150 } 150 }
151 151
152 gfx::Point origin(bounds.origin()); 152 gfx::Point origin(bounds.origin());
153 const gfx::Point display_origin = 153 const gfx::Point display_origin = Shell::GetAshScreen()->
154 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); 154 GetDisplayNearestWindow(window).bounds().origin();
155 origin.Offset(-display_origin.x(), -display_origin.y()); 155 origin.Offset(-display_origin.x(), -display_origin.y());
156 window->SetBounds(gfx::Rect(origin, bounds.size())); 156 window->SetBounds(gfx::Rect(origin, bounds.size()));
157 } 157 }
158 158
159 } // internal 159 } // internal
160 } // ash 160 } // ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698