| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profiles/profile_android.h" | 5 #include "chrome/browser/profiles/profile_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/profiles/profile_destroyer.h" | 9 #include "chrome/browser/profiles/profile_destroyer.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 jboolean ProfileAndroid::HasOffTheRecordProfile(JNIEnv* env, jobject obj) { | 90 jboolean ProfileAndroid::HasOffTheRecordProfile(JNIEnv* env, jobject obj) { |
| 91 return profile_->HasOffTheRecordProfile(); | 91 return profile_->HasOffTheRecordProfile(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 jboolean ProfileAndroid::IsOffTheRecord(JNIEnv* env, jobject obj) { | 94 jboolean ProfileAndroid::IsOffTheRecord(JNIEnv* env, jobject obj) { |
| 95 return profile_->IsOffTheRecord(); | 95 return profile_->IsOffTheRecord(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // static | 98 // static |
| 99 ScopedJavaLocalRef<jobject> GetLastUsedProfile(JNIEnv* env, jclass clazz) { | 99 ScopedJavaLocalRef<jobject> GetLastUsedProfile( |
| 100 JNIEnv* env, |
| 101 const JavaParamRef<jclass>& clazz) { |
| 100 return ProfileAndroid::GetLastUsedProfile(env, clazz); | 102 return ProfileAndroid::GetLastUsedProfile(env, clazz); |
| 101 } | 103 } |
| 102 | 104 |
| 103 ProfileAndroid::ProfileAndroid(Profile* profile) | 105 ProfileAndroid::ProfileAndroid(Profile* profile) |
| 104 : profile_(profile) { | 106 : profile_(profile) { |
| 105 JNIEnv* env = AttachCurrentThread(); | 107 JNIEnv* env = AttachCurrentThread(); |
| 106 base::android::ScopedJavaLocalRef<jobject> jprofile = | 108 base::android::ScopedJavaLocalRef<jobject> jprofile = |
| 107 Java_Profile_create(env, reinterpret_cast<intptr_t>(this)); | 109 Java_Profile_create(env, reinterpret_cast<intptr_t>(this)); |
| 108 obj_.Reset(env, jprofile.obj()); | 110 obj_.Reset(env, jprofile.obj()); |
| 109 } | 111 } |
| 110 | 112 |
| 111 ProfileAndroid::~ProfileAndroid() { | 113 ProfileAndroid::~ProfileAndroid() { |
| 112 Java_Profile_onNativeDestroyed(AttachCurrentThread(), obj_.obj()); | 114 Java_Profile_onNativeDestroyed(AttachCurrentThread(), obj_.obj()); |
| 113 } | 115 } |
| 114 | 116 |
| 115 base::android::ScopedJavaLocalRef<jobject> ProfileAndroid::GetJavaObject() { | 117 base::android::ScopedJavaLocalRef<jobject> ProfileAndroid::GetJavaObject() { |
| 116 return base::android::ScopedJavaLocalRef<jobject>(obj_); | 118 return base::android::ScopedJavaLocalRef<jobject>(obj_); |
| 117 } | 119 } |
| OLD | NEW |