| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "ui/aura/window_tree_host_ozone.h" | |
| 6 | |
| 7 #include "ui/aura/window_event_dispatcher.h" | |
| 8 #include "ui/ozone/public/cursor_factory_ozone.h" | |
| 9 #include "ui/ozone/public/ozone_platform.h" | |
| 10 #include "ui/platform_window/platform_window.h" | |
| 11 | |
| 12 namespace aura { | |
| 13 | |
| 14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) | |
| 15 : widget_(gfx::kNullAcceleratedWidget) { | |
| 16 platform_window_ = | |
| 17 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); | |
| 18 } | |
| 19 | |
| 20 WindowTreeHostOzone::~WindowTreeHostOzone() { | |
| 21 DestroyCompositor(); | |
| 22 DestroyDispatcher(); | |
| 23 } | |
| 24 | |
| 25 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) { | |
| 26 // TOOD(spang): Should we determine which parts changed? | |
| 27 OnHostResized(new_bounds.size()); | |
| 28 OnHostMoved(new_bounds.origin()); | |
| 29 } | |
| 30 | |
| 31 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) { | |
| 32 } | |
| 33 | |
| 34 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) { | |
| 35 SendEventToProcessor(event); | |
| 36 } | |
| 37 | |
| 38 void WindowTreeHostOzone::OnCloseRequest() { | |
| 39 OnHostCloseRequested(); | |
| 40 } | |
| 41 | |
| 42 void WindowTreeHostOzone::OnClosed() { | |
| 43 } | |
| 44 | |
| 45 void WindowTreeHostOzone::OnWindowStateChanged( | |
| 46 ui::PlatformWindowState new_state) { | |
| 47 } | |
| 48 | |
| 49 void WindowTreeHostOzone::OnLostCapture() { | |
| 50 } | |
| 51 | |
| 52 void WindowTreeHostOzone::OnAcceleratedWidgetAvailable( | |
| 53 gfx::AcceleratedWidget widget) { | |
| 54 widget_ = widget; | |
| 55 CreateCompositor(widget_); | |
| 56 } | |
| 57 | |
| 58 void WindowTreeHostOzone::OnActivationChanged(bool active) { | |
| 59 } | |
| 60 | |
| 61 ui::EventSource* WindowTreeHostOzone::GetEventSource() { | |
| 62 return this; | |
| 63 } | |
| 64 | |
| 65 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { | |
| 66 return widget_; | |
| 67 } | |
| 68 | |
| 69 void WindowTreeHostOzone::Show() { | |
| 70 platform_window_->Show(); | |
| 71 } | |
| 72 | |
| 73 void WindowTreeHostOzone::Hide() { | |
| 74 platform_window_->Hide(); | |
| 75 } | |
| 76 | |
| 77 gfx::Rect WindowTreeHostOzone::GetBounds() const { | |
| 78 return platform_window_->GetBounds(); | |
| 79 } | |
| 80 | |
| 81 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { | |
| 82 platform_window_->SetBounds(bounds); | |
| 83 } | |
| 84 | |
| 85 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const { | |
| 86 return platform_window_->GetBounds().origin(); | |
| 87 } | |
| 88 | |
| 89 void WindowTreeHostOzone::SetCapture() { | |
| 90 platform_window_->SetCapture(); | |
| 91 } | |
| 92 | |
| 93 void WindowTreeHostOzone::ReleaseCapture() { | |
| 94 platform_window_->ReleaseCapture(); | |
| 95 } | |
| 96 | |
| 97 void WindowTreeHostOzone::PostNativeEvent( | |
| 98 const base::NativeEvent& native_event) { | |
| 99 SendEventToProcessor(static_cast<ui::Event*>(native_event)); | |
| 100 } | |
| 101 | |
| 102 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) { | |
| 103 platform_window_->SetCursor(cursor.platform()); | |
| 104 } | |
| 105 | |
| 106 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) { | |
| 107 platform_window_->MoveCursorTo(location); | |
| 108 } | |
| 109 | |
| 110 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { | |
| 111 NOTIMPLEMENTED(); | |
| 112 } | |
| 113 | |
| 114 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { | |
| 115 return dispatcher(); | |
| 116 } | |
| 117 | |
| 118 // static | |
| 119 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | |
| 120 return new WindowTreeHostOzone(bounds); | |
| 121 } | |
| 122 | |
| 123 // static | |
| 124 gfx::Size WindowTreeHost::GetNativeScreenSize() { | |
| 125 NOTIMPLEMENTED(); | |
| 126 return gfx::Size(); | |
| 127 } | |
| 128 | |
| 129 } // namespace aura | |
| OLD | NEW |