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

Side by Side Diff: ui/android/window_android.cc

Issue 1144333004: Make WebView work for external displays (over Presentations). Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix another context-use through making WindowAndroid::GetJavaContext public Created 5 years, 5 months 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 2013 The Chromium Authors. All rights reserved. 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 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/android/window_android.h" 5 #include "ui/android/window_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 bool WindowAndroid::CanRequestPermission(const std::string& permission) { 125 bool WindowAndroid::CanRequestPermission(const std::string& permission) {
126 JNIEnv* env = AttachCurrentThread(); 126 JNIEnv* env = AttachCurrentThread();
127 return Java_WindowAndroid_canRequestPermission( 127 return Java_WindowAndroid_canRequestPermission(
128 env, 128 env,
129 GetJavaObject().obj(), 129 GetJavaObject().obj(),
130 base::android::ConvertUTF8ToJavaString(env, permission).obj()); 130 base::android::ConvertUTF8ToJavaString(env, permission).obj());
131 } 131 }
132 132
133 const gfx::DeviceDisplayInfo& WindowAndroid::GetDeviceDisplayInfo() {
134 if (!device_display_info_) {
135 UpdateDeviceDisplayInfo();
136 }
137 return *device_display_info_;
138 }
139
140 void WindowAndroid::UpdateDeviceDisplayInfo() {
141 device_display_info_ = scoped_ptr<gfx::DeviceDisplayInfo>(
142 new gfx::DeviceDisplayInfo(GetJavaContext()));
143 }
144
145 base::android::ScopedJavaLocalRef<jobject> WindowAndroid::GetJavaContext() {
146 JNIEnv* env = AttachCurrentThread();
147 return Java_WindowAndroid_getDisplayContext(env, GetJavaObject().obj());
148 }
149
133 // ---------------------------------------------------------------------------- 150 // ----------------------------------------------------------------------------
134 // Native JNI methods 151 // Native JNI methods
135 // ---------------------------------------------------------------------------- 152 // ----------------------------------------------------------------------------
136 153
137 jlong Init(JNIEnv* env, jobject obj) { 154 jlong Init(JNIEnv* env, jobject obj) {
138 WindowAndroid* window = new WindowAndroid(env, obj); 155 WindowAndroid* window = new WindowAndroid(env, obj);
139 return reinterpret_cast<intptr_t>(window); 156 return reinterpret_cast<intptr_t>(window);
140 } 157 }
141 158
142 } // namespace ui 159 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698