OLD | NEW |
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 <stdint.h> | 7 #include <stdint.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(TabAndroid* parent, | 84 void TabModelJniBridge::CreateTab(TabAndroid* parent, |
85 WebContents* web_contents, | 85 WebContents* web_contents, |
86 int parent_tab_id) { | 86 int parent_tab_id) { |
87 JNIEnv* env = AttachCurrentThread(); | 87 JNIEnv* env = AttachCurrentThread(); |
88 Java_TabModelJniBridge_createTabWithWebContents( | 88 Java_TabModelJniBridge_createTabWithWebContents( |
89 env, java_object_.get(env).obj(), | 89 env, java_object_.get(env).obj(), |
90 parent->GetJavaObject().obj(), | 90 (parent ? parent->GetJavaObject().obj() : NULL), |
91 web_contents->GetBrowserContext()->IsOffTheRecord(), | 91 web_contents->GetBrowserContext()->IsOffTheRecord(), |
92 web_contents->GetJavaWebContents().obj(), | 92 web_contents->GetJavaWebContents().obj(), |
93 parent_tab_id); | 93 parent_tab_id); |
94 } | 94 } |
95 | 95 |
96 WebContents* TabModelJniBridge::GetWebContentsAt(int index) const { | 96 WebContents* TabModelJniBridge::GetWebContentsAt(int index) const { |
97 TabAndroid* tab = GetTabAt(index); | 97 TabAndroid* tab = GetTabAt(index); |
98 return tab == NULL ? NULL : tab->web_contents(); | 98 return tab == NULL ? NULL : tab->web_contents(); |
99 } | 99 } |
100 | 100 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool TabModelJniBridge::Register(JNIEnv* env) { | 219 bool TabModelJniBridge::Register(JNIEnv* env) { |
220 return RegisterNativesImpl(env); | 220 return RegisterNativesImpl(env); |
221 } | 221 } |
222 | 222 |
223 static jlong Init(JNIEnv* env, | 223 static jlong Init(JNIEnv* env, |
224 const JavaParamRef<jobject>& obj, | 224 const JavaParamRef<jobject>& obj, |
225 jboolean is_incognito) { | 225 jboolean is_incognito) { |
226 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); | 226 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); |
227 return reinterpret_cast<intptr_t>(tab_model); | 227 return reinterpret_cast<intptr_t>(tab_model); |
228 } | 228 } |
OLD | NEW |