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

Side by Side Diff: ui/gfx/screen_ash.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | « ui/gfx/screen_android.cc ('k') | ui/gfx/screen_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/gfx/screen.h"
6
7 #include "base/logging.h"
8 #include "ui/gfx/native_widget_types.h"
9
10 namespace gfx {
11
12 // gfx can't depend upon ash, otherwise we have circular dependencies. So,
13 // gfx::Screen is pluggable and Desktop plugs in the real implementation.
14
15 // static
16 Screen* Screen::instance_ = NULL;
17
18 // static
19 void Screen::SetInstance(Screen* screen) {
20 delete instance_;
21 instance_ = screen;
22 }
23
24 // static
25 gfx::Point Screen::GetCursorScreenPoint() {
26 // TODO(erg): Figure out what to do about the Screen class. For now, I've
27 // added default values for when a Screen instance class isn't passed in, but
28 // this is the wrong thing.
29 if (!instance_)
30 return gfx::Point();
31 return instance_->GetCursorScreenPointImpl();
32 }
33
34 // static
35 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
36 if (!instance_)
37 return gfx::Rect(0, 0, 800, 800);
38 return instance_->GetMonitorWorkAreaNearestWindowImpl(window);
39 }
40
41 // static
42 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
43 if (!instance_)
44 return gfx::Rect(0, 0, 800, 800);
45 return instance_->GetMonitorAreaNearestWindowImpl(window);
46 }
47
48 // static
49 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
50 if (!instance_)
51 return gfx::Rect(0, 0, 800, 800);
52 return instance_->GetMonitorWorkAreaNearestPointImpl(point);
53 }
54
55 // static
56 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
57 if (!instance_)
58 return gfx::Rect(0, 0, 800, 800);
59 return instance_->GetMonitorAreaNearestPointImpl(point);
60 }
61
62 // static
63 gfx::Rect Screen::GetPrimaryMonitorWorkArea() {
64 if (!instance_)
65 return gfx::Rect(0, 0, 800, 800);
66 return instance_->GetMonitorWorkAreaNearestPoint(gfx::Point());
67 }
68
69 // static
70 gfx::Rect Screen::GetPrimaryMonitorBounds() {
71 if (!instance_)
72 return gfx::Rect(0, 0, 800, 800);
73 return instance_->GetMonitorAreaNearestPoint(gfx::Point());
74 }
75
76 // static
77 gfx::Rect Screen::GetMonitorWorkAreaMatching(const gfx::Rect& match_rect) {
78 if (!instance_)
79 return gfx::Rect(0, 0, 800, 800);
80 return instance_->GetMonitorWorkAreaNearestPoint(gfx::Point());
81 }
82
83 // static
84 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
85 if (!instance_)
86 return NULL;
87 return instance_->GetWindowAtCursorScreenPointImpl();
88 }
89
90 // static
91 gfx::Size Screen::GetPrimaryMonitorSize() {
92 if (!instance_)
93 return gfx::Size(800, 800);
94 return instance_->GetPrimaryMonitorSizeImpl();
95 }
96
97 // static
98 int Screen::GetNumMonitors() {
99 if (!instance_)
100 return 1;
101 return instance_->GetNumMonitorsImpl();
102 }
103
104 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen_android.cc ('k') | ui/gfx/screen_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698