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/platform_window/android/platform_window_android.h" | 14 #include "ui/platform_window/android/platform_window_android.h" |
15 #endif | 15 #endif |
16 | 16 |
17 #if defined(USE_OZONE) | 17 #if defined(USE_OZONE) |
18 #include "ui/ozone/public/ozone_platform.h" | 18 #include "ui/ozone/public/ozone_platform.h" |
19 #endif | 19 #endif |
20 | 20 |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
23 #include "ui/base/cursor/cursor_loader_win.h" | 23 #include "ui/base/cursor/cursor_loader_win.h" |
24 #include "ui/platform_window/win/win_window.h" | 24 #include "ui/platform_window/win/win_window.h" |
25 #endif | 25 #endif |
26 | 26 |
27 namespace aura { | 27 namespace aura { |
| 28 #if defined(OS_ANDROID) |
| 29 namespace { |
| 30 WindowTreeHostPlatform* instance = nullptr; |
| 31 } |
| 32 |
| 33 // static |
| 34 WindowTreeHostPlatform* WindowTreeHostPlatform::GetHost() { |
| 35 return instance; |
| 36 } |
| 37 #endif |
28 | 38 |
29 // static | 39 // static |
30 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 40 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { |
| 41 #if defined(OS_ANDROID) |
| 42 DCHECK(!instance); |
| 43 instance = new WindowTreeHostPlatform(bounds); |
| 44 return instance; |
| 45 #else |
31 return new WindowTreeHostPlatform(bounds); | 46 return new WindowTreeHostPlatform(bounds); |
| 47 #endif |
32 } | 48 } |
33 | 49 |
34 WindowTreeHostPlatform::WindowTreeHostPlatform(const gfx::Rect& bounds) | 50 WindowTreeHostPlatform::WindowTreeHostPlatform(const gfx::Rect& bounds) |
35 : widget_(gfx::kNullAcceleratedWidget), | 51 : widget_(gfx::kNullAcceleratedWidget), |
36 current_cursor_(ui::kCursorNull), | 52 current_cursor_(ui::kCursorNull), |
37 has_capture_(false) { | 53 has_capture_(false) { |
38 #if defined(USE_OZONE) | 54 #if defined(USE_OZONE) |
39 window_ = | 55 window_ = |
40 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); | 56 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); |
41 #elif defined(OS_WIN) | 57 #elif defined(OS_WIN) |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 DCHECK_EQ(widget, widget_); | 189 DCHECK_EQ(widget, widget_); |
174 widget_ = gfx::kNullAcceleratedWidget; | 190 widget_ = gfx::kNullAcceleratedWidget; |
175 } | 191 } |
176 | 192 |
177 void WindowTreeHostPlatform::OnActivationChanged(bool active) { | 193 void WindowTreeHostPlatform::OnActivationChanged(bool active) { |
178 if (active) | 194 if (active) |
179 OnHostActivated(); | 195 OnHostActivated(); |
180 } | 196 } |
181 | 197 |
182 } // namespace aura | 198 } // namespace aura |
OLD | NEW |