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_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 return Java_WebContentsDelegateAndroid_takeFocus( | 311 return Java_WebContentsDelegateAndroid_takeFocus( |
312 env, obj.obj(), reverse); | 312 env, obj.obj(), reverse); |
313 } | 313 } |
314 | 314 |
315 void WebContentsDelegateAndroid::ShowRepostFormWarningDialog( | 315 void WebContentsDelegateAndroid::ShowRepostFormWarningDialog( |
316 WebContents* source) { | 316 WebContents* source) { |
317 JNIEnv* env = AttachCurrentThread(); | 317 JNIEnv* env = AttachCurrentThread(); |
318 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 318 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
319 if (obj.is_null()) | 319 if (obj.is_null()) |
320 return; | 320 return; |
321 ScopedJavaLocalRef<jobject> content_view_core = | 321 ScopedJavaLocalRef<jobject> web_contents = source->GetJavaWebContents(); |
322 content::ContentViewCore::FromWebContents(source)->GetJavaObject(); | 322 if (web_contents.is_null()) |
323 if (content_view_core.is_null()) | |
324 return; | 323 return; |
325 Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), | 324 Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), |
326 content_view_core.obj()); | 325 web_contents.obj()); |
327 } | 326 } |
328 | 327 |
329 void WebContentsDelegateAndroid::ToggleFullscreenModeForTab( | 328 void WebContentsDelegateAndroid::ToggleFullscreenModeForTab( |
330 WebContents* web_contents, | 329 WebContents* web_contents, |
331 bool enter_fullscreen) { | 330 bool enter_fullscreen) { |
332 JNIEnv* env = AttachCurrentThread(); | 331 JNIEnv* env = AttachCurrentThread(); |
333 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 332 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
334 if (obj.is_null()) | 333 if (obj.is_null()) |
335 return; | 334 return; |
336 Java_WebContentsDelegateAndroid_toggleFullscreenModeForTab( | 335 Java_WebContentsDelegateAndroid_toggleFullscreenModeForTab( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // Native JNI methods | 381 // Native JNI methods |
383 // ---------------------------------------------------------------------------- | 382 // ---------------------------------------------------------------------------- |
384 | 383 |
385 // Register native methods | 384 // Register native methods |
386 | 385 |
387 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 386 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
388 return RegisterNativesImpl(env); | 387 return RegisterNativesImpl(env); |
389 } | 388 } |
390 | 389 |
391 } // namespace web_contents_delegate_android | 390 } // namespace web_contents_delegate_android |
OLD | NEW |