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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "base/compiler_specific.h"
12 #include "base/supports_user_data.h"
16 // Android wrapper around profile that provides safer passage from java and
18 class ProfileAndroid
: public base::SupportsUserData::Data
{
20 static ProfileAndroid
* FromProfile(Profile
* profile
);
21 static Profile
* FromProfileAndroid(jobject obj
);
22 static bool RegisterProfileAndroid(JNIEnv
* env
);
24 static jobject
GetLastUsedProfile(JNIEnv
* env
, jclass clazz
);
26 // Destroys this Profile when possible.
27 void DestroyWhenAppropriate(JNIEnv
* env
, jobject obj
);
29 // Return the original profile.
30 base::android::ScopedJavaLocalRef
<jobject
> GetOriginalProfile(
31 JNIEnv
* env
, jobject obj
);
33 // Return the incognito profile.
35 // WARNING: This will create the OffTheRecord profile if it doesn't already
36 // exist. If this isn't what you want, you need to check
37 // HasOffTheRecordProfile() first.
38 base::android::ScopedJavaLocalRef
<jobject
> GetOffTheRecordProfile(
39 JNIEnv
* env
, jobject obj
);
41 // Return whether an off the record profile exists.
42 jboolean
HasOffTheRecordProfile(JNIEnv
* env
, jobject obj
);
44 // Whether this profile is off the record.
45 jboolean
IsOffTheRecord(JNIEnv
* env
, jobject obj
);
47 explicit ProfileAndroid(Profile
* profile
);
48 ~ProfileAndroid() override
;
50 base::android::ScopedJavaLocalRef
<jobject
> GetJavaObject();
53 Profile
* profile_
; // weak
54 base::android::ScopedJavaGlobalRef
<jobject
> obj_
;
57 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_