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

Side by Side Diff: ui/aura/screen_aura.cc

Issue 9689027: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: crash fix Created 8 years, 9 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 "ui/aura/screen_aura.h" 5 #include "ui/aura/screen_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/env.h"
9 #include "ui/aura/monitor.h"
10 #include "ui/aura/monitor_manager.h"
8 #include "ui/aura/root_window.h" 11 #include "ui/aura/root_window.h"
9 #include "ui/aura/window.h"
10 #include "ui/gfx/native_widget_types.h"
11 12
12 namespace aura { 13 namespace aura {
13 14
14 ScreenAura::ScreenAura(RootWindow* root_window) : root_window_(root_window) { 15 ScreenAura::ScreenAura(RootWindow* root_window) : root_window_(root_window) {
15 } 16 }
16 17
17 ScreenAura::~ScreenAura() { 18 ScreenAura::~ScreenAura() {
18 } 19 }
19 20
20 gfx::Point ScreenAura::GetCursorScreenPointImpl() { 21 gfx::Point ScreenAura::GetCursorScreenPointImpl() {
21 return root_window_->last_mouse_location(); 22 return root_window_->last_mouse_location();
22 } 23 }
23 24
24 gfx::Rect ScreenAura::GetMonitorWorkAreaNearestWindowImpl( 25 gfx::Rect ScreenAura::GetMonitorWorkAreaNearestWindowImpl(
25 gfx::NativeWindow window) { 26 gfx::NativeWindow window) {
26 return GetWorkAreaBounds(); 27 return Env::GetInstance()->monitor_manager()->
28 GetMonitorNearestWindow(window)->GetWorkAreaBounds();
27 } 29 }
28 30
29 gfx::Rect ScreenAura::GetMonitorAreaNearestWindowImpl( 31 gfx::Rect ScreenAura::GetMonitorAreaNearestWindowImpl(
30 gfx::NativeWindow window) { 32 gfx::NativeWindow window) {
31 return GetBounds(); 33 return Env::GetInstance()->monitor_manager()->
34 GetMonitorNearestWindow(window)->bounds();
32 } 35 }
33 36
34 gfx::Rect ScreenAura::GetMonitorWorkAreaNearestPointImpl( 37 gfx::Rect ScreenAura::GetMonitorWorkAreaNearestPointImpl(
35 const gfx::Point& point) { 38 const gfx::Point& point) {
36 return GetWorkAreaBounds(); 39 return Env::GetInstance()->monitor_manager()->
40 GetMonitorNearestPoint(point)->GetWorkAreaBounds();
37 } 41 }
38 42
39 gfx::Rect ScreenAura::GetMonitorAreaNearestPointImpl(const gfx::Point& point) { 43 gfx::Rect ScreenAura::GetMonitorAreaNearestPointImpl(
40 return GetBounds(); 44 const gfx::Point& point) {
45 return Env::GetInstance()->monitor_manager()->
46 GetMonitorNearestPoint(point)->bounds();
41 } 47 }
42 48
43 gfx::NativeWindow ScreenAura::GetWindowAtCursorScreenPointImpl() { 49 gfx::NativeWindow ScreenAura::GetWindowAtCursorScreenPointImpl() {
44 const gfx::Point point = GetCursorScreenPoint(); 50 const gfx::Point point = GetCursorScreenPoint();
45 return root_window_->GetTopWindowContainingPoint(point); 51 return root_window_->GetTopWindowContainingPoint(point);
46 } 52 }
47 53
48 gfx::Rect ScreenAura::GetBounds() {
49 return gfx::Rect(root_window_->bounds().size());
50 }
51
52 gfx::Rect ScreenAura::GetWorkAreaBounds() {
53 gfx::Rect bounds(GetBounds());
54 bounds.Inset(work_area_insets_);
55 return bounds;
56 }
57
58 gfx::Size ScreenAura::GetPrimaryMonitorSizeImpl() { 54 gfx::Size ScreenAura::GetPrimaryMonitorSizeImpl() {
59 return GetMonitorWorkAreaNearestPoint(gfx::Point()).size(); 55 return Env::GetInstance()->monitor_manager()->GetPrimaryMonitor()->size();
60 } 56 }
61 57
62 int ScreenAura::GetNumMonitorsImpl() { 58 int ScreenAura::GetNumMonitorsImpl() {
63 return 1; 59 return Env::GetInstance()->monitor_manager()->GetNumMonitors();
64 } 60 }
65 61
66 } // namespace aura 62 } // namespace aura
OLDNEW
« ui/aura/monitor.h ('K') | « ui/aura/screen_aura.h ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698