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

Side by Side Diff: ash/screen_ash.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: review fixes 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/screen_ash.h" 5 #include "ash/screen_ash.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/multi_display_manager.h" 8 #include "ash/display/multi_display_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) 51 if (window->GetRootWindow() == Shell::GetPrimaryRootWindow())
52 return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); 52 return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window);
53 else 53 else
54 return GetDisplayWorkAreaBoundsInParent(window); 54 return GetDisplayWorkAreaBoundsInParent(window);
55 } 55 }
56 56
57 // static 57 // static
58 gfx::Rect ScreenAsh::GetDisplayBoundsInParent(aura::Window* window) { 58 gfx::Rect ScreenAsh::GetDisplayBoundsInParent(aura::Window* window) {
59 return ConvertRectFromScreen( 59 return ConvertRectFromScreen(
60 window->parent(), 60 window->parent(),
61 gfx::Screen::GetDisplayNearestWindow(window).bounds()); 61 Shell::GetAshScreen()->GetDisplayNearestWindow(window).bounds());
62 } 62 }
63 63
64 // static 64 // static
65 gfx::Rect ScreenAsh::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { 65 gfx::Rect ScreenAsh::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
66 return ConvertRectFromScreen( 66 return ConvertRectFromScreen(
67 window->parent(), 67 window->parent(),
68 gfx::Screen::GetDisplayNearestWindow(window).work_area()); 68 Shell::GetAshScreen()->GetDisplayNearestWindow(window).work_area());
69 } 69 }
70 70
71 // static 71 // static
72 gfx::Rect ScreenAsh::ConvertRectToScreen(aura::Window* window, 72 gfx::Rect ScreenAsh::ConvertRectToScreen(aura::Window* window,
73 const gfx::Rect& rect) { 73 const gfx::Rect& rect) {
74 gfx::Point point = rect.origin(); 74 gfx::Point point = rect.origin();
75 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 75 aura::client::GetScreenPositionClient(window->GetRootWindow())->
76 ConvertPointToScreen(window, &point); 76 ConvertPointToScreen(window, &point);
77 return gfx::Rect(point, rect.size()); 77 return gfx::Rect(point, rect.size());
78 } 78 }
79 79
80 // static 80 // static
81 gfx::Rect ScreenAsh::ConvertRectFromScreen(aura::Window* window, 81 gfx::Rect ScreenAsh::ConvertRectFromScreen(aura::Window* window,
82 const gfx::Rect& rect) { 82 const gfx::Rect& rect) {
83 gfx::Point point = rect.origin(); 83 gfx::Point point = rect.origin();
84 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 84 aura::client::GetScreenPositionClient(window->GetRootWindow())->
85 ConvertPointFromScreen(window, &point); 85 ConvertPointFromScreen(window, &point);
86 return gfx::Rect(point, rect.size()); 86 return gfx::Rect(point, rect.size());
87 } 87 }
88 88
89 // static 89 // static
90 const gfx::Display& ScreenAsh::GetSecondaryDisplay() { 90 const gfx::Display& ScreenAsh::GetSecondaryDisplay() {
91 return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay()); 91 return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay());
92 } 92 }
93 93
94 bool ScreenAsh::IsDIPEnabled() {
95 return true;
96 }
97
94 gfx::Point ScreenAsh::GetCursorScreenPoint() { 98 gfx::Point ScreenAsh::GetCursorScreenPoint() {
95 return aura::Env::GetInstance()->last_mouse_location(); 99 return aura::Env::GetInstance()->last_mouse_location();
96 } 100 }
97 101
98 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { 102 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
99 const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); 103 const gfx::Point point = Shell::GetAshScreen()->GetCursorScreenPoint();
100 return wm::GetRootWindowAt(point)->GetTopWindowContainingPoint(point); 104 return wm::GetRootWindowAt(point)->GetTopWindowContainingPoint(point);
101 } 105 }
102 106
103 int ScreenAsh::GetNumDisplays() { 107 int ScreenAsh::GetNumDisplays() {
104 return GetDisplayManager()->GetNumDisplays(); 108 return GetDisplayManager()->GetNumDisplays();
105 } 109 }
106 110
107 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { 111 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
108 return GetDisplayManager()->GetDisplayNearestWindow(window); 112 return GetDisplayManager()->GetDisplayNearestWindow(window);
109 } 113 }
110 114
111 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { 115 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const {
112 return GetDisplayManager()->GetDisplayNearestPoint(point); 116 return GetDisplayManager()->GetDisplayNearestPoint(point);
113 } 117 }
114 118
115 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const { 119 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const {
116 return GetDisplayManager()->GetDisplayMatching(match_rect); 120 return GetDisplayManager()->GetDisplayMatching(match_rect);
117 } 121 }
118 122
119 gfx::Display ScreenAsh::GetPrimaryDisplay() const { 123 gfx::Display ScreenAsh::GetPrimaryDisplay() const {
120 return DisplayController::GetPrimaryDisplay(); 124 return DisplayController::GetPrimaryDisplay();
121 } 125 }
122 126
123 } // namespace ash 127 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698