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

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

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « ash/display/mouse_cursor_event_filter.cc ('k') | ash/drag_drop/drag_drop_controller.h » ('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 "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/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 } // namespace 51 } // namespace
52 52
53 namespace internal { 53 namespace internal {
54 54
55 void ScreenPositionController::ConvertPointToScreen( 55 void ScreenPositionController::ConvertPointToScreen(
56 const aura::Window* window, 56 const aura::Window* window,
57 gfx::Point* point) { 57 gfx::Point* point) {
58 const aura::RootWindow* root = window->GetRootWindow(); 58 const aura::RootWindow* root = window->GetRootWindow();
59 aura::Window::ConvertPointToWindow(window, root, point); 59 aura::Window::ConvertPointToTarget(window, root, point);
60 if (DisplayController::IsExtendedDesktopEnabled()) { 60 if (DisplayController::IsExtendedDesktopEnabled()) {
61 const gfx::Point display_origin = 61 const gfx::Point display_origin =
62 gfx::Screen::GetDisplayNearestWindow( 62 gfx::Screen::GetDisplayNearestWindow(
63 const_cast<aura::RootWindow*>(root)).bounds().origin(); 63 const_cast<aura::RootWindow*>(root)).bounds().origin();
64 point->Offset(display_origin.x(), display_origin.y()); 64 point->Offset(display_origin.x(), display_origin.y());
65 } 65 }
66 } 66 }
67 67
68 void ScreenPositionController::ConvertPointFromScreen( 68 void ScreenPositionController::ConvertPointFromScreen(
69 const aura::Window* window, 69 const aura::Window* window,
70 gfx::Point* point) { 70 gfx::Point* point) {
71 const aura::RootWindow* root = window->GetRootWindow(); 71 const aura::RootWindow* root = window->GetRootWindow();
72 if (DisplayController::IsExtendedDesktopEnabled()) { 72 if (DisplayController::IsExtendedDesktopEnabled()) {
73 const gfx::Point display_origin = 73 const gfx::Point display_origin =
74 gfx::Screen::GetDisplayNearestWindow( 74 gfx::Screen::GetDisplayNearestWindow(
75 const_cast<aura::RootWindow*>(root)).bounds().origin(); 75 const_cast<aura::RootWindow*>(root)).bounds().origin();
76 point->Offset(-display_origin.x(), -display_origin.y()); 76 point->Offset(-display_origin.x(), -display_origin.y());
77 } 77 }
78 aura::Window::ConvertPointToWindow(root, window, point); 78 aura::Window::ConvertPointToTarget(root, window, point);
79 } 79 }
80 80
81 void ScreenPositionController::SetBounds( 81 void ScreenPositionController::SetBounds(
82 aura::Window* window, 82 aura::Window* window,
83 const gfx::Rect& bounds) { 83 const gfx::Rect& bounds) {
84 if (!DisplayController::IsExtendedDesktopEnabled() || 84 if (!DisplayController::IsExtendedDesktopEnabled() ||
85 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { 85 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) {
86 window->SetBounds(bounds); 86 window->SetBounds(bounds);
87 return; 87 return;
88 } 88 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 gfx::Point origin(bounds.origin()); 129 gfx::Point origin(bounds.origin());
130 const gfx::Point display_origin = 130 const gfx::Point display_origin =
131 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); 131 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin();
132 origin.Offset(-display_origin.x(), -display_origin.y()); 132 origin.Offset(-display_origin.x(), -display_origin.y());
133 window->SetBounds(gfx::Rect(origin, bounds.size())); 133 window->SetBounds(gfx::Rect(origin, bounds.size()));
134 } 134 }
135 135
136 } // internal 136 } // internal
137 } // ash 137 } // ash
OLDNEW
« no previous file with comments | « ash/display/mouse_cursor_event_filter.cc ('k') | ash/drag_drop/drag_drop_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698