blob: 5057c6c7de57e38be12046dd33177ff9eb31f2ca (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
// 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 "ui/platform_window/stub/stub_window.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "ui/base/cursor/platform_cursor.h"
#include "ui/platform_window/platform_window_delegate.h"
namespace ui {
StubWindow::StubWindow(PlatformWindowDelegate* delegate,
bool use_default_accelerated_widget,
const gfx::Rect& bounds)
: bounds_(bounds) {
DCHECK(delegate);
InitDelegate(delegate, use_default_accelerated_widget);
}
StubWindow::StubWindow(const gfx::Rect& bounds) : bounds_(bounds) {}
StubWindow::~StubWindow() = default;
void StubWindow::InitDelegate(PlatformWindowDelegate* delegate,
bool use_default_accelerated_widget) {
DCHECK(delegate);
delegate_ = delegate;
if (use_default_accelerated_widget)
delegate_->OnAcceleratedWidgetAvailable(gfx::kNullAcceleratedWidget);
}
void StubWindow::Show(bool inactive) {}
void StubWindow::Hide() {}
void StubWindow::Close() {
delegate_->OnClosed();
}
bool StubWindow::IsVisible() const {
NOTIMPLEMENTED_LOG_ONCE();
return true;
}
void StubWindow::PrepareForShutdown() {}
void StubWindow::SetBoundsInPixels(const gfx::Rect& bounds) {
// Even if the pixel bounds didn't change this call to the delegate should
// still happen. The device scale factor may have changed which effectively
// changes the bounds.
bounds_ = bounds;
delegate_->OnBoundsChanged(bounds);
}
gfx::Rect StubWindow::GetBoundsInPixels() const {
return bounds_;
}
void StubWindow::SetBoundsInDIP(const gfx::Rect& bounds) {
SetBoundsInPixels(delegate_->ConvertRectToPixels(bounds));
}
gfx::Rect StubWindow::GetBoundsInDIP() const {
return delegate_->ConvertRectToDIP(bounds_);
}
void StubWindow::SetTitle(const std::u16string& title) {}
void StubWindow::SetCapture() {}
void StubWindow::ReleaseCapture() {}
bool StubWindow::HasCapture() const {
return false;
}
void StubWindow::ToggleFullscreen() {
if (window_state_ == ui::PlatformWindowState::kUnknown) {
window_state_ = ui::PlatformWindowState::kFullScreen;
} else {
window_state_ = ui::PlatformWindowState::kUnknown;
}
}
void StubWindow::Maximize() {}
void StubWindow::Minimize() {}
void StubWindow::Restore() {}
PlatformWindowState StubWindow::GetPlatformWindowState() const {
return window_state_;
}
void StubWindow::Activate() {
NOTIMPLEMENTED_LOG_ONCE();
}
void StubWindow::Deactivate() {
NOTIMPLEMENTED_LOG_ONCE();
}
void StubWindow::SetUseNativeFrame(bool use_native_frame) {}
bool StubWindow::ShouldUseNativeFrame() const {
NOTIMPLEMENTED_LOG_ONCE();
return false;
}
void StubWindow::SetCursor(scoped_refptr<PlatformCursor> cursor) {}
void StubWindow::MoveCursorTo(const gfx::Point& location) {}
void StubWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {}
void StubWindow::SetRestoredBoundsInDIP(const gfx::Rect& bounds) {}
gfx::Rect StubWindow::GetRestoredBoundsInDIP() const {
return gfx::Rect();
}
void StubWindow::SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) {}
void StubWindow::SizeConstraintsChanged() {}
} // namespace ui
|