Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: ui/aura/window_tree_host_platform.cc

Issue 1410153003: Browser frame for Aura Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unrelated changes + formatting. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace {
29 static WindowTreeHostAndroid* instance = nullptr;
no sievers 2015/10/28 20:04:51 this class is not a singleton, there will be multi
Hadi 2015/10/29 15:27:02 Going to look into this.
mfomitchev 2015/10/29 15:53:44 @sievers: added you to https://codereview.chromium
30 }
28 31
29 // static 32 // static
30 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { 33 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
31 return new WindowTreeHostPlatform(bounds); 34 return new WindowTreeHostPlatform(bounds);
32 } 35 }
33 36
34 WindowTreeHostPlatform::WindowTreeHostPlatform(const gfx::Rect& bounds) 37 WindowTreeHostPlatform::WindowTreeHostPlatform(const gfx::Rect& bounds)
35 : widget_(gfx::kNullAcceleratedWidget), 38 : widget_(gfx::kNullAcceleratedWidget),
36 current_cursor_(ui::kCursorNull), 39 current_cursor_(ui::kCursorNull),
37 has_capture_(false) { 40 has_capture_(false) {
41 DCHECK(!instance);
42 instance = this;
38 #if defined(USE_OZONE) 43 #if defined(USE_OZONE)
39 window_ = 44 window_ =
40 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds); 45 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
41 #elif defined(OS_WIN) 46 #elif defined(OS_WIN)
42 window_.reset(new ui::WinWindow(this, bounds)); 47 window_.reset(new ui::WinWindow(this, bounds));
43 #elif defined(OS_ANDROID) 48 #elif defined(OS_ANDROID)
44 window_.reset(new ui::PlatformWindowAndroid(this)); 49 window_.reset(new ui::PlatformWindowAndroid(this));
45 #else 50 #else
46 NOTIMPLEMENTED(); 51 NOTIMPLEMENTED();
47 #endif 52 #endif
48 } 53 }
49 54
50 WindowTreeHostPlatform::~WindowTreeHostPlatform() { 55 WindowTreeHostPlatform::~WindowTreeHostPlatform() {
51 DestroyCompositor(); 56 DestroyCompositor();
52 DestroyDispatcher(); 57 DestroyDispatcher();
53 } 58 }
54 59
60 WindowTreeHostPlatform* WindowTreeHostPlatform::GetHost() {
61 return host;
62 }
63
55 ui::EventSource* WindowTreeHostPlatform::GetEventSource() { 64 ui::EventSource* WindowTreeHostPlatform::GetEventSource() {
56 return this; 65 return this;
57 } 66 }
58 67
59 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { 68 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() {
60 return widget_; 69 return widget_;
61 } 70 }
62 71
63 void WindowTreeHostPlatform::ShowImpl() { 72 void WindowTreeHostPlatform::ShowImpl() {
64 window_->Show(); 73 window_->Show();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 DCHECK_EQ(widget, widget_); 182 DCHECK_EQ(widget, widget_);
174 widget_ = gfx::kNullAcceleratedWidget; 183 widget_ = gfx::kNullAcceleratedWidget;
175 } 184 }
176 185
177 void WindowTreeHostPlatform::OnActivationChanged(bool active) { 186 void WindowTreeHostPlatform::OnActivationChanged(bool active) {
178 if (active) 187 if (active)
179 OnHostActivated(); 188 OnHostActivated();
180 } 189 }
181 190
182 } // namespace aura 191 } // namespace aura
OLDNEW
« ui/aura/window_tree_host_platform.h ('K') | « ui/aura/window_tree_host_platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698