OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_platform.h" | 5 #include "ui/aura/window_tree_host_platform.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "ui/aura/window_event_dispatcher.h" | 8 #include "ui/aura/window_event_dispatcher.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
11 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
12 | 12 |
13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 14 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/platform_window/android/platform_window_android.h" | 15 #include "ui/platform_window/android/platform_window_android.h" |
15 #endif | 16 #endif |
16 | 17 |
17 #if defined(USE_OZONE) | 18 #if defined(USE_OZONE) |
18 #include "ui/ozone/public/ozone_platform.h" | 19 #include "ui/ozone/public/ozone_platform.h" |
19 #endif | 20 #endif |
20 | 21 |
21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
22 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
23 #include "ui/base/cursor/cursor_loader_win.h" | 24 #include "ui/base/cursor/cursor_loader_win.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 ui::EventSource* WindowTreeHostPlatform::GetEventSource() { | 66 ui::EventSource* WindowTreeHostPlatform::GetEventSource() { |
66 return this; | 67 return this; |
67 } | 68 } |
68 | 69 |
69 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { | 70 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { |
70 return widget_; | 71 return widget_; |
71 } | 72 } |
72 | 73 |
73 void WindowTreeHostPlatform::ShowImpl() { | 74 void WindowTreeHostPlatform::ShowImpl() { |
| 75 #if defined(OS_ANDROID) |
| 76 ui::PlatformWindowAndroid* pwa = |
| 77 ui::PlatformWindowAndroid::From(window_.get()); |
| 78 if (!pwa->IsAttachedToActivity()) { |
| 79 jobject activity = window()->GetProperty( |
| 80 aura::client::kActivityForRootWindow); |
| 81 pwa->AttachToActivity(activity); |
| 82 } |
| 83 #endif |
74 window_->Show(); | 84 window_->Show(); |
75 } | 85 } |
76 | 86 |
77 void WindowTreeHostPlatform::HideImpl() { | 87 void WindowTreeHostPlatform::HideImpl() { |
78 window_->Hide(); | 88 window_->Hide(); |
79 } | 89 } |
80 | 90 |
81 gfx::Rect WindowTreeHostPlatform::GetBounds() const { | 91 gfx::Rect WindowTreeHostPlatform::GetBounds() const { |
82 return window_->GetBounds(); | 92 return window_->GetBounds(); |
83 } | 93 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 DCHECK_EQ(widget, widget_); | 193 DCHECK_EQ(widget, widget_); |
184 widget_ = gfx::kNullAcceleratedWidget; | 194 widget_ = gfx::kNullAcceleratedWidget; |
185 } | 195 } |
186 | 196 |
187 void WindowTreeHostPlatform::OnActivationChanged(bool active) { | 197 void WindowTreeHostPlatform::OnActivationChanged(bool active) { |
188 if (active) | 198 if (active) |
189 OnHostActivated(); | 199 OnHostActivated(); |
190 } | 200 } |
191 | 201 |
192 } // namespace aura | 202 } // namespace aura |
OLD | NEW |