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

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

Issue 8382019: Move DisplayUtils methods into gfx::Screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove DCHECKS Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/screen.h" 5 #include "ui/gfx/screen.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/native_widget_types.h" 8 #include "ui/gfx/native_widget_types.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 11
12 // gfx can't depend upon aura, otherwise we have circular dependencies. So, 12 // gfx can't depend upon aura, otherwise we have circular dependencies. So,
13 // gfx::Screen is pluggable for aura and Desktop plugs in the real 13 // gfx::Screen is pluggable for aura and Desktop plugs in the real
14 // implementation. 14 // implementation.
15 15
16 // static 16 // static
17 Screen* Screen::instance_ = NULL; 17 Screen* Screen::instance_ = NULL;
18 18
19 // static 19 // static
20 void Screen::SetInstance(Screen* screen) { 20 void Screen::SetInstance(Screen* screen) {
21 delete instance_; 21 delete instance_;
22 instance_ = screen; 22 instance_ = screen;
23 } 23 }
24 24
25 // static 25 // static
26 gfx::Point Screen::GetCursorScreenPoint() { 26 gfx::Point Screen::GetCursorScreenPoint() {
27 DCHECK(instance_);
28 return instance_->GetCursorScreenPointImpl(); 27 return instance_->GetCursorScreenPointImpl();
29 } 28 }
30 29
31 // static 30 // static
32 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) { 31 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(gfx::NativeWindow window) {
33 DCHECK(instance_);
34 return instance_->GetMonitorWorkAreaNearestWindowImpl(window); 32 return instance_->GetMonitorWorkAreaNearestWindowImpl(window);
35 } 33 }
36 34
37 // static 35 // static
38 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) { 36 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeWindow window) {
39 DCHECK(instance_);
40 return instance_->GetMonitorAreaNearestWindowImpl(window); 37 return instance_->GetMonitorAreaNearestWindowImpl(window);
41 } 38 }
42 39
43 // static 40 // static
44 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { 41 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
45 DCHECK(instance_);
46 return instance_->GetMonitorWorkAreaNearestPointImpl(point); 42 return instance_->GetMonitorWorkAreaNearestPointImpl(point);
47 } 43 }
48 44
49 // static 45 // static
50 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) { 46 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
51 DCHECK(instance_);
52 return instance_->GetMonitorAreaNearestPointImpl(point); 47 return instance_->GetMonitorAreaNearestPointImpl(point);
53 } 48 }
54 49
55 // static 50 // static
56 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { 51 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
57 DCHECK(instance_);
58 return instance_->GetWindowAtCursorScreenPointImpl(); 52 return instance_->GetWindowAtCursorScreenPointImpl();
59 } 53 }
60 54
55 // static
56 gfx::Size Screen::GetPrimaryMonitorSize() {
57 return instance_->GetPrimaryMonitorSizeImpl();
58 }
59
60 // static
61 int Screen::GetNumMonitors() {
62 return instance_->GetNumMonitorsImpl();
63 }
64
61 } // namespace gfx 65 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/screen.h ('k') | ui/gfx/screen_gtk.cc » ('j') | ui/ui_unittests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698