Chromium Code Reviews| 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/cursor_factory_ozone.h" | 8 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 9 #include "ui/ozone/public/ozone_platform.h" | 9 #include "ui/ozone/public/ozone_platform.h" |
| 10 #include "ui/platform_window/platform_window.h" | 10 #include "ui/platform_window/platform_window.h" |
| 11 | 11 |
| 12 namespace aura { | 12 namespace aura { |
| 13 | 13 |
| 14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) | 14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) |
| 15 : widget_(gfx::kNullAcceleratedWidget) { | 15 : widget_(gfx::kNullAcceleratedWidget), bounds_(bounds) { |
| 16 platform_window_ = | 16 platform_window_ = |
| 17 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); | 17 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); |
| 18 } | 18 } |
| 19 | 19 |
| 20 WindowTreeHostOzone::~WindowTreeHostOzone() { | 20 WindowTreeHostOzone::~WindowTreeHostOzone() { |
| 21 DestroyCompositor(); | 21 DestroyCompositor(); |
| 22 DestroyDispatcher(); | 22 DestroyDispatcher(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) { | 25 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) { |
| 26 // TOOD(spang): Should we determine which parts changed? | 26 // TOOD(spang): Should we determine which parts changed? |
| 27 OnHostResized(new_bounds.size()); | 27 OnHostResized(new_bounds.size()); |
| 28 OnHostMoved(new_bounds.origin()); | 28 OnHostMoved(new_bounds.origin()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) { | 31 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) { | 34 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) { |
| 35 if (event->IsMouseEvent()) | |
|
spang
2014/11/04 23:27:22
Can you move this entirely into AshWindowTreeHostO
| |
| 36 TranslateLocatedEvent(static_cast<ui::LocatedEvent*>(event)); | |
| 35 SendEventToProcessor(event); | 37 SendEventToProcessor(event); |
| 36 } | 38 } |
| 37 | 39 |
| 38 void WindowTreeHostOzone::OnCloseRequest() { | 40 void WindowTreeHostOzone::OnCloseRequest() { |
| 39 OnHostCloseRequested(); | 41 OnHostCloseRequested(); |
| 40 } | 42 } |
| 41 | 43 |
| 42 void WindowTreeHostOzone::OnClosed() { | 44 void WindowTreeHostOzone::OnClosed() { |
| 43 } | 45 } |
| 44 | 46 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 72 | 74 |
| 73 void WindowTreeHostOzone::Hide() { | 75 void WindowTreeHostOzone::Hide() { |
| 74 platform_window_->Hide(); | 76 platform_window_->Hide(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 gfx::Rect WindowTreeHostOzone::GetBounds() const { | 79 gfx::Rect WindowTreeHostOzone::GetBounds() const { |
| 78 return platform_window_->GetBounds(); | 80 return platform_window_->GetBounds(); |
| 79 } | 81 } |
| 80 | 82 |
| 81 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { | 83 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { |
| 84 bounds_ = bounds; | |
| 82 platform_window_->SetBounds(bounds); | 85 platform_window_->SetBounds(bounds); |
| 83 } | 86 } |
| 84 | 87 |
| 85 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const { | 88 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const { |
| 86 return platform_window_->GetBounds().origin(); | 89 return platform_window_->GetBounds().origin(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 void WindowTreeHostOzone::SetCapture() { | 92 void WindowTreeHostOzone::SetCapture() { |
| 90 platform_window_->SetCapture(); | 93 platform_window_->SetCapture(); |
| 91 } | 94 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 108 } | 111 } |
| 109 | 112 |
| 110 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { | 113 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { |
| 111 NOTIMPLEMENTED(); | 114 NOTIMPLEMENTED(); |
| 112 } | 115 } |
| 113 | 116 |
| 114 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { | 117 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { |
| 115 return dispatcher(); | 118 return dispatcher(); |
| 116 } | 119 } |
| 117 | 120 |
| 121 void WindowTreeHostOzone::TranslateLocatedEvent(ui::LocatedEvent* event) { | |
| 122 } | |
| 123 | |
| 118 // static | 124 // static |
| 119 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 125 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { |
| 120 return new WindowTreeHostOzone(bounds); | 126 return new WindowTreeHostOzone(bounds); |
| 121 } | 127 } |
| 122 | 128 |
| 123 // static | 129 // static |
| 124 gfx::Size WindowTreeHost::GetNativeScreenSize() { | 130 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
| 125 NOTIMPLEMENTED(); | 131 NOTIMPLEMENTED(); |
| 126 return gfx::Size(); | 132 return gfx::Size(); |
| 127 } | 133 } |
| 128 | 134 |
| 129 } // namespace aura | 135 } // namespace aura |
| OLD | NEW |