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

Side by Side Diff: ash/screen_ash.cc

Issue 10905288: Switch primary display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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 | « ash/screen_ash.h ('k') | ash/shell.cc » ('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/screen_ash.h" 5 #include "ash/screen_ash.h"
6 6
7 #include "ash/display/display_controller.h"
7 #include "ash/display/multi_display_manager.h" 8 #include "ash/display/multi_display_manager.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
10 #include "ash/wm/shelf_layout_manager.h" 11 #include "ash/wm/shelf_layout_manager.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "ui/aura/client/screen_position_client.h" 13 #include "ui/aura/client/screen_position_client.h"
13 #include "ui/aura/env.h" 14 #include "ui/aura/env.h"
14 #include "ui/aura/display_manager.h" 15 #include "ui/aura/display_manager.h"
15 #include "ui/aura/root_window.h" 16 #include "ui/aura/root_window.h"
16 #include "ui/gfx/display.h" 17 #include "ui/gfx/display.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 // static 80 // static
80 gfx::Rect ScreenAsh::ConvertRectFromScreen(aura::Window* window, 81 gfx::Rect ScreenAsh::ConvertRectFromScreen(aura::Window* window,
81 const gfx::Rect& rect) { 82 const gfx::Rect& rect) {
82 gfx::Point point = rect.origin(); 83 gfx::Point point = rect.origin();
83 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 84 aura::client::GetScreenPositionClient(window->GetRootWindow())->
84 ConvertPointFromScreen(window, &point); 85 ConvertPointFromScreen(window, &point);
85 return gfx::Rect(point, rect.size()); 86 return gfx::Rect(point, rect.size());
86 } 87 }
87 88
89 // static
90 const gfx::Display& ScreenAsh::GetSecondaryDisplay() {
91 return *(Shell::GetInstance()->display_controller()->GetSecondaryDisplay());
92 }
93
88 gfx::Point ScreenAsh::GetCursorScreenPoint() { 94 gfx::Point ScreenAsh::GetCursorScreenPoint() {
89 return aura::Env::GetInstance()->last_mouse_location(); 95 return aura::Env::GetInstance()->last_mouse_location();
90 } 96 }
91 97
92 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { 98 gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() {
93 const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); 99 const gfx::Point point = gfx::Screen::GetCursorScreenPoint();
94 return wm::GetRootWindowAt(point)->GetTopWindowContainingPoint(point); 100 return wm::GetRootWindowAt(point)->GetTopWindowContainingPoint(point);
95 } 101 }
96 102
97 int ScreenAsh::GetNumDisplays() { 103 int ScreenAsh::GetNumDisplays() {
98 return GetDisplayManager()->GetNumDisplays(); 104 return GetDisplayManager()->GetNumDisplays();
99 } 105 }
100 106
101 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { 107 gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
102 return GetDisplayManager()->GetDisplayNearestWindow(window); 108 return GetDisplayManager()->GetDisplayNearestWindow(window);
103 } 109 }
104 110
105 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { 111 gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const {
106 return GetDisplayManager()->GetDisplayNearestPoint(point); 112 return GetDisplayManager()->GetDisplayNearestPoint(point);
107 } 113 }
108 114
109 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const { 115 gfx::Display ScreenAsh::GetDisplayMatching(const gfx::Rect& match_rect) const {
110 return GetDisplayManager()->GetDisplayMatching(match_rect); 116 return GetDisplayManager()->GetDisplayMatching(match_rect);
111 } 117 }
112 118
113 gfx::Display ScreenAsh::GetPrimaryDisplay() const { 119 gfx::Display ScreenAsh::GetPrimaryDisplay() const {
114 return *GetDisplayManager()->GetDisplayAt(0); 120 return Shell::GetInstance()->display_controller()->primary_display();
115 } 121 }
116 122
117 } // namespace ash 123 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_ash.h ('k') | ash/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698