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 "chrome/browser/component/web_contents_delegate_android/web_contents_de
legate_android.h" | 5 #include "chrome/browser/component/web_contents_delegate_android/web_contents_de
legate_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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (obj.is_null()) | 273 if (obj.is_null()) |
274 return; | 274 return; |
275 ScopedJavaLocalRef<jobject> content_view_core = | 275 ScopedJavaLocalRef<jobject> content_view_core = |
276 content::ContentViewCore::FromWebContents(source)->GetJavaObject(); | 276 content::ContentViewCore::FromWebContents(source)->GetJavaObject(); |
277 if (content_view_core.is_null()) | 277 if (content_view_core.is_null()) |
278 return; | 278 return; |
279 Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), | 279 Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), |
280 content_view_core.obj()); | 280 content_view_core.obj()); |
281 } | 281 } |
282 | 282 |
| 283 void WebContentsDelegateAndroid::ToggleFullscreenModeForTab( |
| 284 WebContents* web_contents, |
| 285 bool enter_fullscreen) { |
| 286 JNIEnv* env = AttachCurrentThread(); |
| 287 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 288 if (obj.is_null()) |
| 289 return; |
| 290 Java_WebContentsDelegateAndroid_toggleFullscreenModeForTab( |
| 291 env, obj.obj(), enter_fullscreen); |
| 292 } |
| 293 |
| 294 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( |
| 295 const WebContents* web_contents) const { |
| 296 JNIEnv* env = AttachCurrentThread(); |
| 297 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 298 if (obj.is_null()) |
| 299 return false; |
| 300 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( |
| 301 env, obj.obj()); |
| 302 } |
| 303 |
283 // ---------------------------------------------------------------------------- | 304 // ---------------------------------------------------------------------------- |
284 // Native JNI methods | 305 // Native JNI methods |
285 // ---------------------------------------------------------------------------- | 306 // ---------------------------------------------------------------------------- |
286 | 307 |
287 // Register native methods | 308 // Register native methods |
288 | 309 |
289 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 310 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
290 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 311 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
291 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 312 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
292 return false; | 313 return false; |
293 } | 314 } |
294 return RegisterNativesImpl(env); | 315 return RegisterNativesImpl(env); |
295 } | 316 } |
296 | 317 |
297 } // namespace web_contents_delegate_android | 318 } // namespace web_contents_delegate_android |
OLD | NEW |