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