| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 TabAndroid* TabModelJniBridge::GetTabAt(int index) const { | 101 TabAndroid* TabModelJniBridge::GetTabAt(int index) const { |
| 102 JNIEnv* env = AttachCurrentThread(); | 102 JNIEnv* env = AttachCurrentThread(); |
| 103 ScopedJavaLocalRef<jobject> jtab = | 103 ScopedJavaLocalRef<jobject> jtab = |
| 104 Java_TabModelJniBridge_getTabAt(env, java_object_.get(env), index); | 104 Java_TabModelJniBridge_getTabAt(env, java_object_.get(env), index); |
| 105 | 105 |
| 106 return jtab.is_null() ? NULL : TabAndroid::GetNativeTab(env, jtab); | 106 return jtab.is_null() ? NULL : TabAndroid::GetNativeTab(env, jtab); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool TabModelJniBridge::IsTabbedActivity() const { |
| 110 JNIEnv* env = AttachCurrentThread(); |
| 111 return Java_TabModelJniBridge_isTabbedActivity(env, java_object_.get(env)); |
| 112 } |
| 113 |
| 109 void TabModelJniBridge::SetActiveIndex(int index) { | 114 void TabModelJniBridge::SetActiveIndex(int index) { |
| 110 JNIEnv* env = AttachCurrentThread(); | 115 JNIEnv* env = AttachCurrentThread(); |
| 111 Java_TabModelJniBridge_setIndex(env, java_object_.get(env), index); | 116 Java_TabModelJniBridge_setIndex(env, java_object_.get(env), index); |
| 112 } | 117 } |
| 113 | 118 |
| 114 void TabModelJniBridge::CloseTabAt(int index) { | 119 void TabModelJniBridge::CloseTabAt(int index) { |
| 115 JNIEnv* env = AttachCurrentThread(); | 120 JNIEnv* env = AttachCurrentThread(); |
| 116 Java_TabModelJniBridge_closeTabAt(env, java_object_.get(env), index); | 121 Java_TabModelJniBridge_closeTabAt(env, java_object_.get(env), index); |
| 117 } | 122 } |
| 118 | 123 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 bool TabModelJniBridge::Register(JNIEnv* env) { | 217 bool TabModelJniBridge::Register(JNIEnv* env) { |
| 213 return RegisterNativesImpl(env); | 218 return RegisterNativesImpl(env); |
| 214 } | 219 } |
| 215 | 220 |
| 216 static jlong Init(JNIEnv* env, | 221 static jlong Init(JNIEnv* env, |
| 217 const JavaParamRef<jobject>& obj, | 222 const JavaParamRef<jobject>& obj, |
| 218 jboolean is_incognito) { | 223 jboolean is_incognito) { |
| 219 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); | 224 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); |
| 220 return reinterpret_cast<intptr_t>(tab_model); | 225 return reinterpret_cast<intptr_t>(tab_model); |
| 221 } | 226 } |
| OLD | NEW |