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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 // Android wrapper around profile that provides safer passage from java and | 16 // Android wrapper around profile that provides safer passage from java and |
17 // back to native. | 17 // back to native. |
18 class ProfileAndroid : public base::SupportsUserData::Data { | 18 class ProfileAndroid : public base::SupportsUserData::Data { |
19 public: | 19 public: |
20 static ProfileAndroid* FromProfile(Profile* profile); | 20 static ProfileAndroid* FromProfile(Profile* profile); |
21 static Profile* FromProfileAndroid(jobject obj); | 21 static Profile* FromProfileAndroid(jobject obj); |
22 static bool RegisterProfileAndroid(JNIEnv* env); | 22 static bool RegisterProfileAndroid(JNIEnv* env); |
23 | 23 |
24 static jobject GetLastUsedProfile(JNIEnv* env, jclass clazz); | 24 static jobject GetLastUsedProfile(JNIEnv* env, jclass clazz); |
25 | 25 |
| 26 // Return the original profile. |
| 27 base::android::ScopedJavaLocalRef<jobject> GetOriginalProfile( |
| 28 JNIEnv* env, jobject obj); |
| 29 |
| 30 // Return the incognito profile. |
| 31 // |
| 32 // WARNING: This will create the OffTheRecord profile if it doesn't already |
| 33 // exist. If this isn't what you want, you need to check |
| 34 // HasOffTheRecordProfile() first. |
| 35 base::android::ScopedJavaLocalRef<jobject> GetOffTheRecordProfile( |
| 36 JNIEnv* env, jobject obj); |
| 37 |
| 38 // Return whether an off the record profile exists. |
| 39 jboolean HasOffTheRecordProfile(JNIEnv* env, jobject obj); |
| 40 |
| 41 // Whether this profile is off the record. |
| 42 jboolean IsOffTheRecord(JNIEnv* env, jobject obj); |
| 43 |
26 explicit ProfileAndroid(Profile* profile); | 44 explicit ProfileAndroid(Profile* profile); |
27 virtual ~ProfileAndroid(); | 45 virtual ~ProfileAndroid(); |
28 | 46 |
29 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 47 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
30 | 48 |
31 private: | 49 private: |
32 Profile* profile_; // weak | 50 Profile* profile_; // weak |
33 base::android::ScopedJavaGlobalRef<jobject> obj_; | 51 base::android::ScopedJavaGlobalRef<jobject> obj_; |
34 }; | 52 }; |
35 | 53 |
36 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ | 54 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ |
OLD | NEW |