OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/root_window_host_ozone.h" | 5 #include "ui/aura/root_window_host_ozone.h" |
6 | 6 |
7 #include "ui/aura/root_window.h" | 7 #include "ui/aura/root_window.h" |
8 #include "ui/events/ozone/event_factory_ozone.h" | 8 #include "ui/events/ozone/event_factory_ozone.h" |
9 #include "ui/gfx/ozone/surface_factory_ozone.h" | 9 #include "ui/gfx/ozone/surface_factory_ozone.h" |
10 #include "ui/ozone/ozone_platform.h" | 10 #include "ui/ozone/ozone_platform.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 | 13 |
14 RootWindowHostOzone::RootWindowHostOzone(const gfx::Rect& bounds) | 14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) |
15 : widget_(0), | 15 : widget_(0), |
16 bounds_(bounds) { | 16 bounds_(bounds) { |
17 ui::OzonePlatform::Initialize(); | 17 ui::OzonePlatform::Initialize(); |
18 | 18 |
19 // EventFactoryOzone creates converters that obtain input events from the | 19 // EventFactoryOzone creates converters that obtain input events from the |
20 // underlying input system and dispatch them as |ui::Event| instances into | 20 // underlying input system and dispatch them as |ui::Event| instances into |
21 // Aura. | 21 // Aura. |
22 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents(); | 22 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents(); |
23 | 23 |
24 gfx::SurfaceFactoryOzone* surface_factory = | 24 gfx::SurfaceFactoryOzone* surface_factory = |
25 gfx::SurfaceFactoryOzone::GetInstance(); | 25 gfx::SurfaceFactoryOzone::GetInstance(); |
26 widget_ = surface_factory->GetAcceleratedWidget(); | 26 widget_ = surface_factory->GetAcceleratedWidget(); |
27 | 27 |
28 surface_factory->AttemptToResizeAcceleratedWidget(widget_, bounds_); | 28 surface_factory->AttemptToResizeAcceleratedWidget(widget_, bounds_); |
29 | 29 |
30 base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this); | 30 base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this); |
31 CreateCompositor(GetAcceleratedWidget()); | 31 CreateCompositor(GetAcceleratedWidget()); |
32 } | 32 } |
33 | 33 |
34 RootWindowHostOzone::~RootWindowHostOzone() { | 34 WindowTreeHostOzone::~WindowTreeHostOzone() { |
35 base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0); | 35 base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0); |
36 } | 36 } |
37 | 37 |
38 bool RootWindowHostOzone::Dispatch(const base::NativeEvent& ne) { | 38 bool WindowTreeHostOzone::Dispatch(const base::NativeEvent& ne) { |
39 ui::Event* event = static_cast<ui::Event*>(ne); | 39 ui::Event* event = static_cast<ui::Event*>(ne); |
40 if (event->IsTouchEvent()) { | 40 if (event->IsTouchEvent()) { |
41 ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(ne); | 41 ui::TouchEvent* touchev = static_cast<ui::TouchEvent*>(ne); |
42 delegate_->OnHostTouchEvent(touchev); | 42 delegate_->OnHostTouchEvent(touchev); |
43 } else if (event->IsKeyEvent()) { | 43 } else if (event->IsKeyEvent()) { |
44 ui::KeyEvent* keyev = static_cast<ui::KeyEvent*>(ne); | 44 ui::KeyEvent* keyev = static_cast<ui::KeyEvent*>(ne); |
45 delegate_->OnHostKeyEvent(keyev); | 45 delegate_->OnHostKeyEvent(keyev); |
46 } else if (event->IsMouseEvent()) { | 46 } else if (event->IsMouseEvent()) { |
47 ui::MouseEvent* mouseev = static_cast<ui::MouseEvent*>(ne); | 47 ui::MouseEvent* mouseev = static_cast<ui::MouseEvent*>(ne); |
48 delegate_->OnHostMouseEvent(mouseev); | 48 delegate_->OnHostMouseEvent(mouseev); |
49 } | 49 } |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 RootWindow* RootWindowHostOzone::GetRootWindow() { | 53 RootWindow* WindowTreeHostOzone::GetRootWindow() { |
54 return delegate_->AsRootWindow(); | 54 return delegate_->AsRootWindow(); |
55 } | 55 } |
56 | 56 |
57 gfx::AcceleratedWidget RootWindowHostOzone::GetAcceleratedWidget() { | 57 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { |
58 return widget_; | 58 return widget_; |
59 } | 59 } |
60 | 60 |
61 void RootWindowHostOzone::Show() { NOTIMPLEMENTED(); } | 61 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); } |
62 | 62 |
63 void RootWindowHostOzone::Hide() { NOTIMPLEMENTED(); } | 63 void WindowTreeHostOzone::Hide() { NOTIMPLEMENTED(); } |
64 | 64 |
65 void RootWindowHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); } | 65 void WindowTreeHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); } |
66 | 66 |
67 gfx::Rect RootWindowHostOzone::GetBounds() const { return bounds_; } | 67 gfx::Rect WindowTreeHostOzone::GetBounds() const { return bounds_; } |
68 | 68 |
69 void RootWindowHostOzone::SetBounds(const gfx::Rect& bounds) { | 69 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { |
70 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
71 } | 71 } |
72 | 72 |
73 gfx::Insets RootWindowHostOzone::GetInsets() const { return gfx::Insets(); } | 73 gfx::Insets WindowTreeHostOzone::GetInsets() const { return gfx::Insets(); } |
74 | 74 |
75 void RootWindowHostOzone::SetInsets(const gfx::Insets& insets) { | 75 void WindowTreeHostOzone::SetInsets(const gfx::Insets& insets) { |
76 NOTIMPLEMENTED(); | 76 NOTIMPLEMENTED(); |
77 } | 77 } |
78 | 78 |
79 gfx::Point RootWindowHostOzone::GetLocationOnNativeScreen() const { | 79 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const { |
80 return bounds_.origin(); | 80 return bounds_.origin(); |
81 } | 81 } |
82 | 82 |
83 void RootWindowHostOzone::SetCapture() { NOTIMPLEMENTED(); } | 83 void WindowTreeHostOzone::SetCapture() { NOTIMPLEMENTED(); } |
84 | 84 |
85 void RootWindowHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); } | 85 void WindowTreeHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); } |
86 | 86 |
87 void RootWindowHostOzone::SetCursor(gfx::NativeCursor cursor) { | 87 void WindowTreeHostOzone::SetCursor(gfx::NativeCursor cursor) { |
88 NOTIMPLEMENTED(); | 88 NOTIMPLEMENTED(); |
89 } | 89 } |
90 | 90 |
91 bool RootWindowHostOzone::QueryMouseLocation(gfx::Point* location_return) { | 91 bool WindowTreeHostOzone::QueryMouseLocation(gfx::Point* location_return) { |
92 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
93 return false; | 93 return false; |
94 } | 94 } |
95 | 95 |
96 bool RootWindowHostOzone::ConfineCursorToRootWindow() { | 96 bool WindowTreeHostOzone::ConfineCursorToRootWindow() { |
97 NOTIMPLEMENTED(); | 97 NOTIMPLEMENTED(); |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 void RootWindowHostOzone::UnConfineCursor() { NOTIMPLEMENTED(); } | 101 void WindowTreeHostOzone::UnConfineCursor() { NOTIMPLEMENTED(); } |
102 | 102 |
103 void RootWindowHostOzone::OnCursorVisibilityChanged(bool show) { | 103 void WindowTreeHostOzone::OnCursorVisibilityChanged(bool show) { |
104 NOTIMPLEMENTED(); | 104 NOTIMPLEMENTED(); |
105 } | 105 } |
106 | 106 |
107 void RootWindowHostOzone::MoveCursorTo(const gfx::Point& location) { | 107 void WindowTreeHostOzone::MoveCursorTo(const gfx::Point& location) { |
108 NOTIMPLEMENTED(); | 108 NOTIMPLEMENTED(); |
109 } | 109 } |
110 | 110 |
111 void RootWindowHostOzone::PostNativeEvent( | 111 void WindowTreeHostOzone::PostNativeEvent( |
112 const base::NativeEvent& native_event) { | 112 const base::NativeEvent& native_event) { |
113 NOTIMPLEMENTED(); | 113 NOTIMPLEMENTED(); |
114 } | 114 } |
115 | 115 |
116 void RootWindowHostOzone::OnDeviceScaleFactorChanged( | 116 void WindowTreeHostOzone::OnDeviceScaleFactorChanged( |
117 float device_scale_factor) { | 117 float device_scale_factor) { |
118 NOTIMPLEMENTED(); | 118 NOTIMPLEMENTED(); |
119 } | 119 } |
120 | 120 |
121 void RootWindowHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); } | 121 void WindowTreeHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); } |
122 | 122 |
123 // static | 123 // static |
124 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { | 124 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { |
125 return new RootWindowHostOzone(bounds); | 125 return new WindowTreeHostOzone(bounds); |
126 } | 126 } |
127 | 127 |
128 // static | 128 // static |
129 gfx::Size RootWindowHost::GetNativeScreenSize() { | 129 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
130 NOTIMPLEMENTED(); | 130 NOTIMPLEMENTED(); |
131 return gfx::Size(); | 131 return gfx::Size(); |
132 } | 132 } |
133 | 133 |
134 } // namespace aura | 134 } // namespace aura |
OLD | NEW |