Chromium Code Reviews| 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" |
| 11 #include "content/public/browser/android/content_view_core.h" | |
| 11 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
| 12 #include "content/public/browser/invalidate_type.h" | 13 #include "content/public/browser/invalidate_type.h" |
| 13 #include "content/public/browser/page_navigator.h" | 14 #include "content/public/browser/page_navigator.h" |
| 14 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
| 18 #include "content/public/common/referrer.h" | 19 #include "content/public/common/referrer.h" |
| 19 #include "jni/WebContentsDelegateAndroid_jni.h" | 20 #include "jni/WebContentsDelegateAndroid_jni.h" |
| 20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 | 259 |
| 259 bool WebContentsDelegateAndroid::TakeFocus(WebContents* source, bool reverse) { | 260 bool WebContentsDelegateAndroid::TakeFocus(WebContents* source, bool reverse) { |
| 260 JNIEnv* env = AttachCurrentThread(); | 261 JNIEnv* env = AttachCurrentThread(); |
| 261 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 262 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 262 if (obj.is_null()) | 263 if (obj.is_null()) |
| 263 return WebContentsDelegate::TakeFocus(source, reverse); | 264 return WebContentsDelegate::TakeFocus(source, reverse); |
| 264 return Java_WebContentsDelegateAndroid_takeFocus( | 265 return Java_WebContentsDelegateAndroid_takeFocus( |
| 265 env, obj.obj(), reverse); | 266 env, obj.obj(), reverse); |
| 266 } | 267 } |
| 267 | 268 |
| 269 void WebContentsDelegateAndroid::ShowRepostFormWarningDialog( | |
| 270 WebContents* source) { | |
| 271 JNIEnv* env = AttachCurrentThread(); | |
| 272 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | |
| 273 if (obj.is_null()) | |
| 274 return; | |
| 275 ScopedJavaLocalRef<jobject> content_view_core = | |
| 276 content::ContentViewCore::FromWebContents(source)->GetJavaObject(); | |
|
Ted C
2012/10/24 23:25:51
should be indented +2 (and below)
sgurun-gerrit only
2012/10/24 23:41:44
Done.
| |
| 277 if (content_view_core.is_null()) | |
| 278 return; | |
| 279 Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), | |
| 280 content_view_core.obj()); | |
| 281 } | |
| 282 | |
| 268 // ---------------------------------------------------------------------------- | 283 // ---------------------------------------------------------------------------- |
| 269 // Native JNI methods | 284 // Native JNI methods |
| 270 // ---------------------------------------------------------------------------- | 285 // ---------------------------------------------------------------------------- |
| 271 | 286 |
| 272 // Register native methods | 287 // Register native methods |
| 273 | 288 |
| 274 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 289 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
| 275 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 290 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
| 276 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 291 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
| 277 return false; | 292 return false; |
| 278 } | 293 } |
| 279 return RegisterNativesImpl(env); | 294 return RegisterNativesImpl(env); |
| 280 } | 295 } |
| 281 | 296 |
| 282 } // namespace web_contents_delegate_android | 297 } // namespace web_contents_delegate_android |
| OLD | NEW |