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