summaryrefslogtreecommitdiffstats
path: root/ui/aura/root_window_host_ozone.cc
blob: 2e046bc61ed5a0c3b4f9cbecc14767555670a94d (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
// 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"

namespace aura {

RootWindowHostOzone::RootWindowHostOzone(const gfx::Rect& bounds)
    : delegate_(NULL), bounds_(bounds), factory_(new ui::EventFactoryOzone()) {
  factory_->CreateEvdevWatchers();
  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);
  }
  return true;
}

void RootWindowHostOzone::SetDelegate(RootWindowHostDelegate* delegate) {
  delegate_ = delegate;
}

RootWindow* RootWindowHostOzone::GetRootWindow() {
  return delegate_->AsRootWindow();
}

gfx::AcceleratedWidget RootWindowHostOzone::GetAcceleratedWidget() {
  // TODO(rjkroege): Support more than one screen. Screen ids start at 1 and
  // increase for each screen.
  return (gfx::AcceleratedWidget)1;
}

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::SetFocusWhenShown(bool focus_when_shown) {
  NOTIMPLEMENTED();
}

bool RootWindowHostOzone::CopyAreaToSkCanvas(const gfx::Rect& source_bounds,
                                             const gfx::Point& dest_offset,
                                             SkCanvas* canvas) {
  NOTIMPLEMENTED();
  return false;
}

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