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

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

Issue 1455793005: Adding a way to associate Android Activities with PlatformWindowAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@auraclank_upstream_native_widget
Patch Set: Making the new property "owned" property. Created 5 years 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
« no previous file with comments | « ui/aura/client/aura_constants.cc ('k') | ui/platform_window/android/platform_window_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/android/jni_android.h"
15 #include "ui/aura/client/aura_constants.h"
14 #include "ui/platform_window/android/platform_window_android.h" 16 #include "ui/platform_window/android/platform_window_android.h"
15 #endif 17 #endif
16 18
17 #if defined(USE_OZONE) 19 #if defined(USE_OZONE)
18 #include "ui/ozone/public/ozone_platform.h" 20 #include "ui/ozone/public/ozone_platform.h"
19 #endif 21 #endif
20 22
21 #if defined(OS_WIN) 23 #if defined(OS_WIN)
22 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
23 #include "ui/base/cursor/cursor_loader_win.h" 25 #include "ui/base/cursor/cursor_loader_win.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 67
66 ui::EventSource* WindowTreeHostPlatform::GetEventSource() { 68 ui::EventSource* WindowTreeHostPlatform::GetEventSource() {
67 return this; 69 return this;
68 } 70 }
69 71
70 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { 72 gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() {
71 return widget_; 73 return widget_;
72 } 74 }
73 75
74 void WindowTreeHostPlatform::ShowImpl() { 76 void WindowTreeHostPlatform::ShowImpl() {
77 #if defined(OS_ANDROID)
78 JNIEnv* env = base::android::AttachCurrentThread();
79 ui::PlatformWindowAndroid* pwa =
80 ui::PlatformWindowAndroid::From(window_.get());
81 if (!pwa->IsAttachedToActivity()) {
82 base::android::ScopedJavaLocalRef<jobject> activity =
83 window()->GetProperty(aura::client::kActivityForRootWindow)->get(env);
84 if (activity.is_null())
85 return;
86 pwa->AttachToActivity(env, activity);
87 }
88 #endif
75 window_->Show(); 89 window_->Show();
76 } 90 }
77 91
78 void WindowTreeHostPlatform::HideImpl() { 92 void WindowTreeHostPlatform::HideImpl() {
79 window_->Hide(); 93 window_->Hide();
80 } 94 }
81 95
82 gfx::Rect WindowTreeHostPlatform::GetBounds() const { 96 gfx::Rect WindowTreeHostPlatform::GetBounds() const {
83 return window_->GetBounds(); 97 return window_->GetBounds();
84 } 98 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DCHECK_EQ(widget, widget_); 190 DCHECK_EQ(widget, widget_);
177 widget_ = gfx::kNullAcceleratedWidget; 191 widget_ = gfx::kNullAcceleratedWidget;
178 } 192 }
179 193
180 void WindowTreeHostPlatform::OnActivationChanged(bool active) { 194 void WindowTreeHostPlatform::OnActivationChanged(bool active) {
181 if (active) 195 if (active)
182 OnHostActivated(); 196 OnHostActivated();
183 } 197 }
184 198
185 } // namespace aura 199 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/client/aura_constants.cc ('k') | ui/platform_window/android/platform_window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698