OLD | NEW |
---|---|
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 Loading... | |
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>( | |
boliu
2015/07/15 06:38:47
make_scoped_ptr
gsennton
2015/07/15 19:26:21
Done.
| |
142 new gfx::DeviceDisplayInfo(GetJavaDisplayContext())); | |
143 } | |
144 | |
145 base::android::ScopedJavaLocalRef<jobject> | |
146 WindowAndroid::GetJavaDisplayContext() { | |
147 JNIEnv* env = AttachCurrentThread(); | |
148 return Java_WindowAndroid_getDisplayContext(env, GetJavaObject().obj()); | |
149 } | |
150 | |
133 // ---------------------------------------------------------------------------- | 151 // ---------------------------------------------------------------------------- |
134 // Native JNI methods | 152 // Native JNI methods |
135 // ---------------------------------------------------------------------------- | 153 // ---------------------------------------------------------------------------- |
136 | 154 |
137 jlong Init(JNIEnv* env, jobject obj) { | 155 jlong Init(JNIEnv* env, jobject obj) { |
138 WindowAndroid* window = new WindowAndroid(env, obj); | 156 WindowAndroid* window = new WindowAndroid(env, obj); |
139 return reinterpret_cast<intptr_t>(window); | 157 return reinterpret_cast<intptr_t>(window); |
140 } | 158 } |
141 | 159 |
142 } // namespace ui | 160 } // namespace ui |
OLD | NEW |