1 // Copyright 2015 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 "ui/mojo/init/screen_mojo.h"
10 ScreenMojo::ScreenMojo(const gfx::Size
& screen_size_in_pixels
,
11 float device_pixel_ratio
)
12 : screen_size_in_pixels_(screen_size_in_pixels
),
13 device_pixel_ratio_(device_pixel_ratio
) {
14 static int64 synthesized_display_id
= 2000;
15 display_
.set_id(synthesized_display_id
++);
16 display_
.SetScaleAndBounds(device_pixel_ratio
,
17 gfx::Rect(screen_size_in_pixels
));
20 gfx::Point
ScreenMojo::GetCursorScreenPoint() {
24 gfx::NativeWindow
ScreenMojo::GetWindowUnderCursor() {
29 gfx::NativeWindow
ScreenMojo::GetWindowAtScreenPoint(const gfx::Point
& point
) {
34 gfx::Display
ScreenMojo::GetPrimaryDisplay() const {
38 gfx::Display
ScreenMojo::GetDisplayNearestWindow(gfx::NativeView view
) const {
39 return GetPrimaryDisplay();
42 gfx::Display
ScreenMojo::GetDisplayNearestPoint(const gfx::Point
& point
) const {
43 return GetPrimaryDisplay();
46 int ScreenMojo::GetNumDisplays() const {
50 std::vector
<gfx::Display
> ScreenMojo::GetAllDisplays() const {
51 return std::vector
<gfx::Display
>(1, GetPrimaryDisplay());
54 gfx::Display
ScreenMojo::GetDisplayMatching(const gfx::Rect
& match_rect
) const {
55 return GetPrimaryDisplay();
58 void ScreenMojo::AddObserver(gfx::DisplayObserver
* observer
) {
59 // TODO: add support for display changes.
62 void ScreenMojo::RemoveObserver(gfx::DisplayObserver
* observer
) {
63 // TODO: add support for display changes.