Get foreground tab on Android
[chromium-blink-merge.git] / ui / aura / root_window_host_ozone.cc
blob937b70f65bed02c09af616c5dbbc0a5e089014ba
1 // Copyright 2013 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 "ui/aura/root_window_host_ozone.h"
7 #include "ui/aura/root_window.h"
8 #include "ui/events/ozone/event_factory_ozone.h"
9 #include "ui/gfx/ozone/surface_factory_ozone.h"
10 #include "ui/ozone/ozone_platform.h"
12 namespace aura {
14 RootWindowHostOzone::RootWindowHostOzone(const gfx::Rect& bounds)
15 : widget_(0),
16 bounds_(bounds) {
17 ui::OzonePlatform::Initialize();
19 // EventFactoryOzone creates converters that obtain input events from the
20 // underlying input system and dispatch them as |ui::Event| instances into
21 // Aura.
22 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents();
24 gfx::SurfaceFactoryOzone* surface_factory =
25 gfx::SurfaceFactoryOzone::GetInstance();
26 widget_ = surface_factory->GetAcceleratedWidget();
28 surface_factory->AttemptToResizeAcceleratedWidget(widget_, bounds_);
30 base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this);
33 RootWindowHostOzone::~RootWindowHostOzone() {
34 base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0);
37 bool RootWindowHostOzone::Dispatch(const base::NativeEvent& ne) {
38 ui::Event* event = static_cast<ui::Event*>(ne);
39 if (event->IsTouchEvent()) {
40 ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(ne);
41 delegate_->OnHostTouchEvent(touchev);
42 } else if (event->IsKeyEvent()) {
43 ui::KeyEvent* keyev = static_cast<ui::KeyEvent*>(ne);
44 delegate_->OnHostKeyEvent(keyev);
45 } else if (event->IsMouseEvent()) {
46 ui::MouseEvent* mouseev = static_cast<ui::MouseEvent*>(ne);
47 delegate_->OnHostMouseEvent(mouseev);
49 return true;
52 RootWindow* RootWindowHostOzone::GetRootWindow() {
53 return delegate_->AsRootWindow();
56 gfx::AcceleratedWidget RootWindowHostOzone::GetAcceleratedWidget() {
57 return widget_;
60 void RootWindowHostOzone::Show() { NOTIMPLEMENTED(); }
62 void RootWindowHostOzone::Hide() { NOTIMPLEMENTED(); }
64 void RootWindowHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); }
66 gfx::Rect RootWindowHostOzone::GetBounds() const { return bounds_; }
68 void RootWindowHostOzone::SetBounds(const gfx::Rect& bounds) {
69 NOTIMPLEMENTED();
72 gfx::Insets RootWindowHostOzone::GetInsets() const { return gfx::Insets(); }
74 void RootWindowHostOzone::SetInsets(const gfx::Insets& insets) {
75 NOTIMPLEMENTED();
78 gfx::Point RootWindowHostOzone::GetLocationOnNativeScreen() const {
79 return bounds_.origin();
82 void RootWindowHostOzone::SetCapture() { NOTIMPLEMENTED(); }
84 void RootWindowHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); }
86 void RootWindowHostOzone::SetCursor(gfx::NativeCursor cursor) {
87 NOTIMPLEMENTED();
90 bool RootWindowHostOzone::QueryMouseLocation(gfx::Point* location_return) {
91 NOTIMPLEMENTED();
92 return false;
95 bool RootWindowHostOzone::ConfineCursorToRootWindow() {
96 NOTIMPLEMENTED();
97 return false;
100 void RootWindowHostOzone::UnConfineCursor() { NOTIMPLEMENTED(); }
102 void RootWindowHostOzone::OnCursorVisibilityChanged(bool show) {
103 NOTIMPLEMENTED();
106 void RootWindowHostOzone::MoveCursorTo(const gfx::Point& location) {
107 NOTIMPLEMENTED();
110 void RootWindowHostOzone::PostNativeEvent(
111 const base::NativeEvent& native_event) {
112 NOTIMPLEMENTED();
115 void RootWindowHostOzone::OnDeviceScaleFactorChanged(
116 float device_scale_factor) {
117 NOTIMPLEMENTED();
120 void RootWindowHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); }
122 // static
123 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
124 return new RootWindowHostOzone(bounds);
127 // static
128 gfx::Size RootWindowHost::GetNativeScreenSize() {
129 NOTIMPLEMENTED();
130 return gfx::Size();
133 } // namespace aura