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/browser_process.h" |
8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/profiles/profile_destroyer.h" | 10 #include "chrome/browser/profiles/profile_destroyer.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "jni/Profile_jni.h" | 12 #include "jni/Profile_jni.h" |
12 | 13 |
13 using base::android::AttachCurrentThread; | 14 using base::android::AttachCurrentThread; |
14 | 15 |
15 namespace { | 16 namespace { |
16 const char kProfileAndroidKey[] = "profile_android"; | 17 const char kProfileAndroidKey[] = "profile_android"; |
17 } // namespace | 18 } // namespace |
(...skipping 24 matching lines...) Expand all Loading... |
42 return profile_android->profile_; | 43 return profile_android->profile_; |
43 } | 44 } |
44 | 45 |
45 // static | 46 // static |
46 bool ProfileAndroid::RegisterProfileAndroid(JNIEnv* env) { | 47 bool ProfileAndroid::RegisterProfileAndroid(JNIEnv* env) { |
47 return RegisterNativesImpl(env); | 48 return RegisterNativesImpl(env); |
48 } | 49 } |
49 | 50 |
50 // static | 51 // static |
51 jobject ProfileAndroid::GetLastUsedProfile(JNIEnv* env, jclass clazz) { | 52 jobject ProfileAndroid::GetLastUsedProfile(JNIEnv* env, jclass clazz) { |
52 Profile* profile = ProfileManager::GetLastUsedProfile(); | 53 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); |
53 if (profile == NULL) { | 54 if (profile == NULL) { |
54 NOTREACHED() << "Profile not found."; | 55 NOTREACHED() << "Profile not found."; |
55 return NULL; | 56 return NULL; |
56 } | 57 } |
57 | 58 |
58 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile); | 59 ProfileAndroid* profile_android = ProfileAndroid::FromProfile(profile); |
59 if (profile_android == NULL) { | 60 if (profile_android == NULL) { |
60 NOTREACHED() << "ProfileAndroid not found."; | 61 NOTREACHED() << "ProfileAndroid not found."; |
61 return NULL; | 62 return NULL; |
62 } | 63 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 obj_.Reset(env, jprofile.obj()); | 108 obj_.Reset(env, jprofile.obj()); |
108 } | 109 } |
109 | 110 |
110 ProfileAndroid::~ProfileAndroid() { | 111 ProfileAndroid::~ProfileAndroid() { |
111 Java_Profile_onNativeDestroyed(AttachCurrentThread(), obj_.obj()); | 112 Java_Profile_onNativeDestroyed(AttachCurrentThread(), obj_.obj()); |
112 } | 113 } |
113 | 114 |
114 base::android::ScopedJavaLocalRef<jobject> ProfileAndroid::GetJavaObject() { | 115 base::android::ScopedJavaLocalRef<jobject> ProfileAndroid::GetJavaObject() { |
115 return base::android::ScopedJavaLocalRef<jobject>(obj_); | 116 return base::android::ScopedJavaLocalRef<jobject>(obj_); |
116 } | 117 } |
OLD | NEW |