Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 571813003: Fix Tab.getWebContents for downstream instrumentation tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove native method Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 if (delete_native) { 434 if (delete_native) {
435 web_contents_.reset(); 435 web_contents_.reset();
436 synced_tab_delegate_->ResetWebContents(); 436 synced_tab_delegate_->ResetWebContents();
437 } else { 437 } else {
438 // Release the WebContents so it does not get deleted by the scoped_ptr. 438 // Release the WebContents so it does not get deleted by the scoped_ptr.
439 ignore_result(web_contents_.release()); 439 ignore_result(web_contents_.release());
440 } 440 }
441 } 441 }
442 442
443 base::android::ScopedJavaLocalRef<jobject> TabAndroid::GetWebContents(
444 JNIEnv* env,
445 jobject obj) {
446 if (!web_contents_.get())
447 return base::android::ScopedJavaLocalRef<jobject>();
448 return web_contents_->GetJavaWebContents();
449 }
450
451 base::android::ScopedJavaLocalRef<jobject> TabAndroid::GetProfileAndroid( 443 base::android::ScopedJavaLocalRef<jobject> TabAndroid::GetProfileAndroid(
452 JNIEnv* env, 444 JNIEnv* env,
453 jobject obj) { 445 jobject obj) {
454 Profile* profile = GetProfile(); 446 Profile* profile = GetProfile();
455 if (!profile) 447 if (!profile)
456 return base::android::ScopedJavaLocalRef<jobject>(); 448 return base::android::ScopedJavaLocalRef<jobject>();
457 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile); 449 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile);
458 if (!profile_android) 450 if (!profile_android)
459 return base::android::ScopedJavaLocalRef<jobject>(); 451 return base::android::ScopedJavaLocalRef<jobject>();
460 452
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 652
661 static void Init(JNIEnv* env, jobject obj) { 653 static void Init(JNIEnv* env, jobject obj) {
662 TRACE_EVENT0("native", "TabAndroid::Init"); 654 TRACE_EVENT0("native", "TabAndroid::Init");
663 // This will automatically bind to the Java object and pass ownership there. 655 // This will automatically bind to the Java object and pass ownership there.
664 new TabAndroid(env, obj); 656 new TabAndroid(env, obj);
665 } 657 }
666 658
667 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 659 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
668 return RegisterNativesImpl(env); 660 return RegisterNativesImpl(env);
669 } 661 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698