| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 content::INVALIDATE_TYPE_TAB | content::INVALIDATE_TYPE_TITLE)) { | 126 content::INVALIDATE_TYPE_TAB | content::INVALIDATE_TYPE_TITLE)) { |
| 127 JNIEnv* env = AttachCurrentThread(); | 127 JNIEnv* env = AttachCurrentThread(); |
| 128 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 128 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 129 if (obj.is_null()) | 129 if (obj.is_null()) |
| 130 return; | 130 return; |
| 131 Java_WebContentsDelegateAndroid_onTabHeaderStateChanged( | 131 Java_WebContentsDelegateAndroid_onTabHeaderStateChanged( |
| 132 env, obj.obj()); | 132 env, obj.obj()); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 void WebContentsDelegateAndroid::AddNewContents( | 136 bool WebContentsDelegateAndroid::AddNewContents( |
| 137 WebContents* source, | 137 WebContents* source, |
| 138 WebContents* new_contents, | 138 WebContents* new_contents, |
| 139 WindowOpenDisposition disposition, | 139 WindowOpenDisposition disposition, |
| 140 const gfx::Rect& initial_pos, | 140 const gfx::Rect& initial_pos, |
| 141 bool user_gesture) { | 141 bool user_gesture) { |
| 142 JNIEnv* env = AttachCurrentThread(); | 142 JNIEnv* env = AttachCurrentThread(); |
| 143 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 143 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 144 bool handled = false; | 144 bool handled = false; |
| 145 if (!obj.is_null()) { | 145 if (!obj.is_null()) { |
| 146 handled = Java_WebContentsDelegateAndroid_addNewContents( | 146 handled = Java_WebContentsDelegateAndroid_addNewContents( |
| 147 env, | 147 env, |
| 148 obj.obj(), | 148 obj.obj(), |
| 149 reinterpret_cast<jint>(source), | 149 reinterpret_cast<jint>(source), |
| 150 reinterpret_cast<jint>(new_contents), | 150 reinterpret_cast<jint>(new_contents), |
| 151 static_cast<jint>(disposition), | 151 static_cast<jint>(disposition), |
| 152 NULL, | 152 NULL, |
| 153 user_gesture); | 153 user_gesture); |
| 154 } | 154 } |
| 155 if (!handled) | 155 if (!handled) |
| 156 delete new_contents; | 156 delete new_contents; |
| 157 return true; |
| 157 } | 158 } |
| 158 | 159 |
| 159 void WebContentsDelegateAndroid::ActivateContents(WebContents* contents) { | 160 void WebContentsDelegateAndroid::ActivateContents(WebContents* contents) { |
| 160 // TODO(dtrainor) When doing the merge I came across this. Should we be | 161 // TODO(dtrainor) When doing the merge I came across this. Should we be |
| 161 // activating this tab here? | 162 // activating this tab here? |
| 162 } | 163 } |
| 163 | 164 |
| 164 void WebContentsDelegateAndroid::DeactivateContents(WebContents* contents) { | 165 void WebContentsDelegateAndroid::DeactivateContents(WebContents* contents) { |
| 165 // Do nothing. | 166 // Do nothing. |
| 166 } | 167 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 349 |
| 349 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 350 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
| 350 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 351 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
| 351 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 352 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
| 352 return false; | 353 return false; |
| 353 } | 354 } |
| 354 return RegisterNativesImpl(env); | 355 return RegisterNativesImpl(env); |
| 355 } | 356 } |
| 356 | 357 |
| 357 } // namespace web_contents_delegate_android | 358 } // namespace web_contents_delegate_android |
| OLD | NEW |