Refactored not to expose raw pointers on ProxyList class.
[chromium-blink-merge.git] / chromecast / graphics / cast_screen.cc
blob2cf113f8ff655eab96edb663f5f449676a8e1eef
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 "chromecast/graphics/cast_screen.h"
7 #include "ui/aura/env.h"
8 #include "ui/gfx/geometry/rect_conversions.h"
9 #include "ui/gfx/geometry/size_conversions.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/gfx/screen.h"
13 namespace chromecast {
15 namespace {
17 const int64 kDisplayId = 1;
19 const int k720pWidth = 1280;
20 const int k720pHeight = 720;
22 // When CastScreen is first initialized, we may not have any display info
23 // available. These constants hold the initial size that we default to, and
24 // the size can be updated when we have actual display info at hand with
25 // UpdateDisplaySize().
26 const int kInitDisplayWidth = k720pWidth;
27 const int kInitDisplayHeight = k720pHeight;
29 } // namespace
31 CastScreen::~CastScreen() {
34 void CastScreen::UpdateDisplaySize(const gfx::Size& size) {
35 display_.SetScaleAndBounds(1.0f, gfx::Rect(size));
38 gfx::Point CastScreen::GetCursorScreenPoint() {
39 return aura::Env::GetInstance()->last_mouse_location();
42 gfx::NativeWindow CastScreen::GetWindowUnderCursor() {
43 NOTIMPLEMENTED();
44 return gfx::NativeWindow(nullptr);
47 gfx::NativeWindow CastScreen::GetWindowAtScreenPoint(const gfx::Point& point) {
48 NOTIMPLEMENTED();
49 return gfx::NativeWindow(nullptr);
52 int CastScreen::GetNumDisplays() const {
53 return 1;
56 std::vector<gfx::Display> CastScreen::GetAllDisplays() const {
57 return std::vector<gfx::Display>(1, display_);
60 gfx::Display CastScreen::GetDisplayNearestWindow(
61 gfx::NativeWindow window) const {
62 return display_;
65 gfx::Display CastScreen::GetDisplayNearestPoint(const gfx::Point& point) const {
66 return display_;
69 gfx::Display CastScreen::GetDisplayMatching(const gfx::Rect& match_rect) const {
70 return display_;
73 gfx::Display CastScreen::GetPrimaryDisplay() const {
74 return display_;
77 void CastScreen::AddObserver(gfx::DisplayObserver* observer) {
80 void CastScreen::RemoveObserver(gfx::DisplayObserver* observer) {
83 CastScreen::CastScreen() : display_(kDisplayId) {
84 display_.SetScaleAndBounds(1.0f,
85 gfx::Rect(kInitDisplayWidth, kInitDisplayHeight));
88 } // namespace chromecast