blob: 937b70f65bed02c09af616c5dbbc0a5e089014ba (
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
130
131
132
133
|
// Copyright 2013 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/aura/root_window_host_ozone.h"
#include "ui/aura/root_window.h"
#include "ui/events/ozone/event_factory_ozone.h"
#include "ui/gfx/ozone/surface_factory_ozone.h"
#include "ui/ozone/ozone_platform.h"
namespace aura {
RootWindowHostOzone::RootWindowHostOzone(const gfx::Rect& bounds)
: widget_(0),
bounds_(bounds) {
ui::OzonePlatform::Initialize();
// EventFactoryOzone creates converters that obtain input events from the
// underlying input system and dispatch them as |ui::Event| instances into
// Aura.
ui::EventFactoryOzone::GetInstance()->StartProcessingEvents();
gfx::SurfaceFactoryOzone* surface_factory =
gfx::SurfaceFactoryOzone::GetInstance();
widget_ = surface_factory->GetAcceleratedWidget();
surface_factory->AttemptToResizeAcceleratedWidget(widget_, bounds_);
base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this);
}
RootWindowHostOzone::~RootWindowHostOzone() {
base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0);
}
bool RootWindowHostOzone::Dispatch(const base::NativeEvent& ne) {
ui::Event* event = static_cast<ui::Event*>(ne);
if (event->IsTouchEvent()) {
ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(ne);
delegate_->OnHostTouchEvent(touchev);
} else if (event->IsKeyEvent()) {
ui::KeyEvent* keyev = static_cast<ui::KeyEvent*>(ne);
delegate_->OnHostKeyEvent(keyev);
} else if (event->IsMouseEvent()) {
ui::MouseEvent* mouseev = static_cast<ui::MouseEvent*>(ne);
delegate_->OnHostMouseEvent(mouseev);
}
return true;
}
RootWindow* RootWindowHostOzone::GetRootWindow() {
return delegate_->AsRootWindow();
}
gfx::AcceleratedWidget RootWindowHostOzone::GetAcceleratedWidget() {
return widget_;
}
void RootWindowHostOzone::Show() { NOTIMPLEMENTED(); }
void RootWindowHostOzone::Hide() { NOTIMPLEMENTED(); }
void RootWindowHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); }
gfx::Rect RootWindowHostOzone::GetBounds() const { return bounds_; }
void RootWindowHostOzone::SetBounds(const gfx::Rect& bounds) {
NOTIMPLEMENTED();
}
gfx::Insets RootWindowHostOzone::GetInsets() const { return gfx::Insets(); }
void RootWindowHostOzone::SetInsets(const gfx::Insets& insets) {
NOTIMPLEMENTED();
}
gfx::Point RootWindowHostOzone::GetLocationOnNativeScreen() const {
return bounds_.origin();
}
void RootWindowHostOzone::SetCapture() { NOTIMPLEMENTED(); }
void RootWindowHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); }
void RootWindowHostOzone::SetCursor(gfx::NativeCursor cursor) {
NOTIMPLEMENTED();
}
bool RootWindowHostOzone::QueryMouseLocation(gfx::Point* location_return) {
NOTIMPLEMENTED();
return false;
}
bool RootWindowHostOzone::ConfineCursorToRootWindow() {
NOTIMPLEMENTED();
return false;
}
void RootWindowHostOzone::UnConfineCursor() { NOTIMPLEMENTED(); }
void RootWindowHostOzone::OnCursorVisibilityChanged(bool show) {
NOTIMPLEMENTED();
}
void RootWindowHostOzone::MoveCursorTo(const gfx::Point& location) {
NOTIMPLEMENTED();
}
void RootWindowHostOzone::PostNativeEvent(
const base::NativeEvent& native_event) {
NOTIMPLEMENTED();
}
void RootWindowHostOzone::OnDeviceScaleFactorChanged(
float device_scale_factor) {
NOTIMPLEMENTED();
}
void RootWindowHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); }
// static
RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
return new RootWindowHostOzone(bounds);
}
// static
gfx::Size RootWindowHost::GetNativeScreenSize() {
NOTIMPLEMENTED();
return gfx::Size();
}
} // namespace aura
|