| 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/android/chrome_web_contents_delegate_android.h" | 5 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 handled = Java_ChromeWebContentsDelegateAndroid_addNewContents( | 316 handled = Java_ChromeWebContentsDelegateAndroid_addNewContents( |
| 317 env, | 317 env, |
| 318 obj.obj(), | 318 obj.obj(), |
| 319 reinterpret_cast<intptr_t>(source), | 319 reinterpret_cast<intptr_t>(source), |
| 320 reinterpret_cast<intptr_t>(new_contents), | 320 reinterpret_cast<intptr_t>(new_contents), |
| 321 static_cast<jint>(disposition), | 321 static_cast<jint>(disposition), |
| 322 NULL, | 322 NULL, |
| 323 user_gesture); | 323 user_gesture); |
| 324 } | 324 } |
| 325 | 325 |
| 326 if (was_blocked) |
| 327 *was_blocked = !handled; |
| 326 if (!handled) | 328 if (!handled) |
| 327 delete new_contents; | 329 delete new_contents; |
| 328 } | 330 } |
| 329 | 331 |
| 330 void ChromeWebContentsDelegateAndroid::WebContentsCreated( | 332 void ChromeWebContentsDelegateAndroid::WebContentsCreated( |
| 331 content::WebContents* source_contents, int opener_render_frame_id, | 333 content::WebContents* source_contents, int opener_render_frame_id, |
| 332 const base::string16& frame_name, const GURL& target_url, | 334 const base::string16& frame_name, const GURL& target_url, |
| 333 content::WebContents* new_contents) { | 335 content::WebContents* new_contents) { |
| 334 JNIEnv* env = AttachCurrentThread(); | 336 JNIEnv* env = AttachCurrentThread(); |
| 335 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 337 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 336 if (obj.is_null()) | 338 if (obj.is_null()) |
| 337 return; | 339 return; |
| 338 Java_ChromeWebContentsDelegateAndroid_webContentsCreated(env, obj.obj(), | 340 Java_ChromeWebContentsDelegateAndroid_webContentsCreated(env, obj.obj(), |
| 339 reinterpret_cast<intptr_t>(source_contents), opener_render_frame_id, | 341 reinterpret_cast<intptr_t>(source_contents), opener_render_frame_id, |
| 340 base::android::ConvertUTF16ToJavaString(env, frame_name).Release(), | 342 base::android::ConvertUTF16ToJavaString(env, frame_name).Release(), |
| 341 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(), | 343 base::android::ConvertUTF8ToJavaString(env, target_url.spec()).Release(), |
| 342 reinterpret_cast<intptr_t>(new_contents)); | 344 reinterpret_cast<intptr_t>(new_contents)); |
| 343 } | 345 } |
| 344 | 346 |
| 345 } // namespace android | 347 } // namespace android |
| 346 } // namespace chrome | 348 } // namespace chrome |
| OLD | NEW |