1 // Copyright 2014 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.
5 #include "mojo/services/view_manager/screen_impl.h"
7 #include "ui/gfx/native_widget_types.h"
8 #include "ui/gfx/rect_conversions.h"
14 gfx::Screen
* ScreenImpl::Create() {
15 return new ScreenImpl(gfx::Rect(0, 0, 800, 600));
18 ScreenImpl::~ScreenImpl() {
21 bool ScreenImpl::IsDIPEnabled() {
26 gfx::Point
ScreenImpl::GetCursorScreenPoint() {
31 gfx::NativeWindow
ScreenImpl::GetWindowUnderCursor() {
32 return GetWindowAtScreenPoint(GetCursorScreenPoint());
35 gfx::NativeWindow
ScreenImpl::GetWindowAtScreenPoint(const gfx::Point
& point
) {
40 int ScreenImpl::GetNumDisplays() const {
44 std::vector
<gfx::Display
> ScreenImpl::GetAllDisplays() const {
45 return std::vector
<gfx::Display
>(1, display_
);
48 gfx::Display
ScreenImpl::GetDisplayNearestWindow(
49 gfx::NativeWindow window
) const {
53 gfx::Display
ScreenImpl::GetDisplayNearestPoint(const gfx::Point
& point
) const {
57 gfx::Display
ScreenImpl::GetDisplayMatching(const gfx::Rect
& match_rect
) const {
61 gfx::Display
ScreenImpl::GetPrimaryDisplay() const {
65 void ScreenImpl::AddObserver(gfx::DisplayObserver
* observer
) {
68 void ScreenImpl::RemoveObserver(gfx::DisplayObserver
* observer
) {
71 ScreenImpl::ScreenImpl(const gfx::Rect
& screen_bounds
) {
72 static int64 synthesized_display_id
= 2000;
73 display_
.set_id(synthesized_display_id
++);
74 display_
.SetScaleAndBounds(1.0f
, screen_bounds
);
77 } // namespace service