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