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

Side by Side Diff: chrome/browser/ui/android/tab_model/tab_model_jni_bridge.cc

Issue 831523005: Remove most native WebContents references from Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kept same error checking behavior for aw_contents.cc Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/android/tab_model/tab_model_jni_bridge.h" 5 #include "chrome/browser/ui/android/tab_model/tab_model_jni_bridge.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/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 int TabModelJniBridge::GetActiveIndex() const { 79 int TabModelJniBridge::GetActiveIndex() const {
80 JNIEnv* env = AttachCurrentThread(); 80 JNIEnv* env = AttachCurrentThread();
81 return Java_TabModelJniBridge_index(env, java_object_.get(env).obj()); 81 return Java_TabModelJniBridge_index(env, java_object_.get(env).obj());
82 } 82 }
83 83
84 void TabModelJniBridge::CreateTab(WebContents* web_contents, 84 void TabModelJniBridge::CreateTab(WebContents* web_contents,
85 int parent_tab_id) { 85 int parent_tab_id) {
86 JNIEnv* env = AttachCurrentThread(); 86 JNIEnv* env = AttachCurrentThread();
87 Java_TabModelJniBridge_createTabWithNativeContents( 87 Java_TabModelJniBridge_createTabWithWebContents(
88 env, java_object_.get(env).obj(), 88 env, java_object_.get(env).obj(),
89 web_contents->GetBrowserContext()->IsOffTheRecord(), 89 web_contents->GetBrowserContext()->IsOffTheRecord(),
90 reinterpret_cast<intptr_t>(web_contents), parent_tab_id); 90 web_contents->GetJavaWebContents().obj(),
91 parent_tab_id);
91 } 92 }
92 93
93 WebContents* TabModelJniBridge::GetWebContentsAt(int index) const { 94 WebContents* TabModelJniBridge::GetWebContentsAt(int index) const {
94 TabAndroid* tab = GetTabAt(index); 95 TabAndroid* tab = GetTabAt(index);
95 return tab == NULL ? NULL : tab->web_contents(); 96 return tab == NULL ? NULL : tab->web_contents();
96 } 97 }
97 98
98 TabAndroid* TabModelJniBridge::GetTabAt(int index) const { 99 TabAndroid* TabModelJniBridge::GetTabAt(int index) const {
99 JNIEnv* env = AttachCurrentThread(); 100 JNIEnv* env = AttachCurrentThread();
100 ScopedJavaLocalRef<jobject> jtab = 101 ScopedJavaLocalRef<jobject> jtab =
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 214 }
214 215
215 bool TabModelJniBridge::Register(JNIEnv* env) { 216 bool TabModelJniBridge::Register(JNIEnv* env) {
216 return RegisterNativesImpl(env); 217 return RegisterNativesImpl(env);
217 } 218 }
218 219
219 static jlong Init(JNIEnv* env, jobject obj, jboolean is_incognito) { 220 static jlong Init(JNIEnv* env, jobject obj, jboolean is_incognito) {
220 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); 221 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito);
221 return reinterpret_cast<intptr_t>(tab_model); 222 return reinterpret_cast<intptr_t>(tab_model);
222 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698