| 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 27 matching lines...) Expand all Loading... |
| 38 Profile* profile = ProfileManager::GetActiveUserProfile(); | 38 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 39 if (is_incognito) | 39 if (is_incognito) |
| 40 return profile->GetOffTheRecordProfile(); | 40 return profile->GetOffTheRecordProfile(); |
| 41 return profile; | 41 return profile; |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace | 44 } // namespace |
| 45 | 45 |
| 46 TabModelJniBridge::TabModelJniBridge(JNIEnv* env, | 46 TabModelJniBridge::TabModelJniBridge(JNIEnv* env, |
| 47 jobject jobj, | 47 jobject jobj, |
| 48 bool is_incognito) | 48 bool is_incognito, |
| 49 : TabModel(FindProfile(is_incognito)), | 49 bool is_tabbed_activity) |
| 50 : TabModel(FindProfile(is_incognito), is_tabbed_activity), |
| 50 java_object_(env, env->NewWeakGlobalRef(jobj)) { | 51 java_object_(env, env->NewWeakGlobalRef(jobj)) { |
| 51 TabModelList::AddTabModel(this); | 52 TabModelList::AddTabModel(this); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void TabModelJniBridge::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 55 void TabModelJniBridge::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 55 delete this; | 56 delete this; |
| 56 } | 57 } |
| 57 | 58 |
| 58 ScopedJavaLocalRef<jobject> TabModelJniBridge::GetProfileAndroid( | 59 ScopedJavaLocalRef<jobject> TabModelJniBridge::GetProfileAndroid( |
| 59 JNIEnv* env, | 60 JNIEnv* env, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 TabModelJniBridge::~TabModelJniBridge() { | 209 TabModelJniBridge::~TabModelJniBridge() { |
| 209 TabModelList::RemoveTabModel(this); | 210 TabModelList::RemoveTabModel(this); |
| 210 } | 211 } |
| 211 | 212 |
| 212 bool TabModelJniBridge::Register(JNIEnv* env) { | 213 bool TabModelJniBridge::Register(JNIEnv* env) { |
| 213 return RegisterNativesImpl(env); | 214 return RegisterNativesImpl(env); |
| 214 } | 215 } |
| 215 | 216 |
| 216 static jlong Init(JNIEnv* env, | 217 static jlong Init(JNIEnv* env, |
| 217 const JavaParamRef<jobject>& obj, | 218 const JavaParamRef<jobject>& obj, |
| 218 jboolean is_incognito) { | 219 jboolean is_incognito, |
| 219 TabModel* tab_model = new TabModelJniBridge(env, obj, is_incognito); | 220 jboolean is_tabbed_activity) { |
| 221 TabModel* tab_model = |
| 222 new TabModelJniBridge(env, obj, is_incognito, is_tabbed_activity); |
| 220 return reinterpret_cast<intptr_t>(tab_model); | 223 return reinterpret_cast<intptr_t>(tab_model); |
| 221 } | 224 } |
| OLD | NEW |