BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_android.h
blobe6ed2c87da21a13b8bd22b965f36d877465ac7fb
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_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/compiler_specific.h"
12 #include "base/supports_user_data.h"
14 class Profile;
16 // Android wrapper around profile that provides safer passage from java and
17 // back to native.
18 class ProfileAndroid : public base::SupportsUserData::Data {
19 public:
20 static ProfileAndroid* FromProfile(Profile* profile);
21 static Profile* FromProfileAndroid(jobject obj);
22 static bool RegisterProfileAndroid(JNIEnv* env);
24 static base::android::ScopedJavaLocalRef<jobject> GetLastUsedProfile(
25 JNIEnv* env,
26 jclass clazz);
28 // Destroys this Profile when possible.
29 void DestroyWhenAppropriate(JNIEnv* env, jobject obj);
31 // Return the original profile.
32 base::android::ScopedJavaLocalRef<jobject> GetOriginalProfile(
33 JNIEnv* env, jobject obj);
35 // Return the incognito profile.
37 // WARNING: This will create the OffTheRecord profile if it doesn't already
38 // exist. If this isn't what you want, you need to check
39 // HasOffTheRecordProfile() first.
40 base::android::ScopedJavaLocalRef<jobject> GetOffTheRecordProfile(
41 JNIEnv* env, jobject obj);
43 // Return whether an off the record profile exists.
44 jboolean HasOffTheRecordProfile(JNIEnv* env, jobject obj);
46 // Whether this profile is off the record.
47 jboolean IsOffTheRecord(JNIEnv* env, jobject obj);
49 explicit ProfileAndroid(Profile* profile);
50 ~ProfileAndroid() override;
52 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
54 private:
55 Profile* profile_; // weak
56 base::android::ScopedJavaGlobalRef<jobject> obj_;
59 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_