blob: 2017dc9a0fb042e9ab72279e9c06fbf04812ca33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/graphics/cast_screen.h"
#include <stdint.h>
#include "ui/aura/env.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/screen.h"
namespace chromecast {
namespace {
const int64_t kDisplayId = 1;
const int k720pWidth = 1280;
const int k720pHeight = 720;
// When CastScreen is first initialized, we may not have any display info
// available. These constants hold the initial size that we default to, and
// the size can be updated when we have actual display info at hand with
// UpdateDisplaySize().
const int kInitDisplayWidth = k720pWidth;
const int kInitDisplayHeight = k720pHeight;
} // namespace
CastScreen::~CastScreen() {
}
void CastScreen::SetDisplayResizeCallback(const DisplayResizeCallback& cb) {
DCHECK(!cb.is_null());
display_resize_cb_ = cb;
}
void CastScreen::UpdateDisplaySize(const gfx::Size& size) {
display_.SetScaleAndBounds(1.0f, gfx::Rect(size));
if (!display_resize_cb_.is_null())
display_resize_cb_.Run(Size(size.width(), size.height()));
}
gfx::Point CastScreen::GetCursorScreenPoint() {
return aura::Env::GetInstance()->last_mouse_location();
}
gfx::NativeWindow CastScreen::GetWindowUnderCursor() {
NOTIMPLEMENTED();
return gfx::NativeWindow(nullptr);
}
gfx::NativeWindow CastScreen::GetWindowAtScreenPoint(const gfx::Point& point) {
return gfx::NativeWindow(nullptr);
}
int CastScreen::GetNumDisplays() const {
return 1;
}
std::vector<gfx::Display> CastScreen::GetAllDisplays() const {
return std::vector<gfx::Display>(1, display_);
}
gfx::Display CastScreen::GetDisplayNearestWindow(
gfx::NativeWindow window) const {
return display_;
}
gfx::Display CastScreen::GetDisplayNearestPoint(const gfx::Point& point) const {
return display_;
}
gfx::Display CastScreen::GetDisplayMatching(const gfx::Rect& match_rect) const {
return display_;
}
gfx::Display CastScreen::GetPrimaryDisplay() const {
return display_;
}
void CastScreen::AddObserver(gfx::DisplayObserver* observer) {
}
void CastScreen::RemoveObserver(gfx::DisplayObserver* observer) {
}
CastScreen::CastScreen() : display_(kDisplayId) {
display_.SetScaleAndBounds(1.0f,
gfx::Rect(kInitDisplayWidth, kInitDisplayHeight));
}
} // namespace chromecast
|