OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/web_contents_delegate_android/web_contents_delegate_android
.h" | 5 #include "components/web_contents_delegate_android/web_contents_delegate_android
.h" |
6 | 6 |
7 #include <android/keycodes.h> | 7 #include <android/keycodes.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( | 293 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( |
294 const WebContents* web_contents) const { | 294 const WebContents* web_contents) const { |
295 JNIEnv* env = AttachCurrentThread(); | 295 JNIEnv* env = AttachCurrentThread(); |
296 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 296 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
297 if (obj.is_null()) | 297 if (obj.is_null()) |
298 return false; | 298 return false; |
299 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( | 299 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( |
300 env, obj.obj()); | 300 env, obj.obj()); |
301 } | 301 } |
302 | 302 |
| 303 void WebContentsDelegateAndroid::UpdatePreferredSize( |
| 304 WebContents* web_contents, |
| 305 const gfx::Size& pref_size) { |
| 306 JNIEnv* env = AttachCurrentThread(); |
| 307 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 308 if (obj.is_null()) |
| 309 return; |
| 310 return Java_WebContentsDelegateAndroid_updatePreferredSize( |
| 311 env, obj.obj(), pref_size.width(), pref_size.height()); |
| 312 } |
| 313 |
303 // ---------------------------------------------------------------------------- | 314 // ---------------------------------------------------------------------------- |
304 // Native JNI methods | 315 // Native JNI methods |
305 // ---------------------------------------------------------------------------- | 316 // ---------------------------------------------------------------------------- |
306 | 317 |
307 // Register native methods | 318 // Register native methods |
308 | 319 |
309 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 320 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
310 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 321 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
311 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 322 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
312 return false; | 323 return false; |
313 } | 324 } |
314 return RegisterNativesImpl(env); | 325 return RegisterNativesImpl(env); |
315 } | 326 } |
316 | 327 |
317 } // namespace components | 328 } // namespace components |
OLD | NEW |