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 package org.chromium.chrome.browser.profiles;
7 import org.chromium.base.CalledByNative;
10 * Wrapper that allows passing a Profile reference around in the Java layer.
12 public class Profile {
14 private long mNativeProfileAndroid;
16 private Profile(long nativeProfileAndroid) {
17 mNativeProfileAndroid = nativeProfileAndroid;
20 public static Profile getLastUsedProfile() {
21 return (Profile) nativeGetLastUsedProfile();
24 public Profile getOriginalProfile() {
25 return (Profile) nativeGetOriginalProfile(mNativeProfileAndroid);
28 public Profile getOffTheRecordProfile() {
29 return (Profile) nativeGetOffTheRecordProfile(mNativeProfileAndroid);
32 public boolean hasOffTheRecordProfile() {
33 return nativeHasOffTheRecordProfile(mNativeProfileAndroid);
36 public boolean isOffTheRecord() {
37 return nativeIsOffTheRecord(mNativeProfileAndroid);
41 private static Profile create(long nativeProfileAndroid) {
42 return new Profile(nativeProfileAndroid);
46 private void destroy() {
47 mNativeProfileAndroid = 0;
51 private long getNativePointer() {
52 return mNativeProfileAndroid;
55 private static native Object nativeGetLastUsedProfile();
56 private native Object nativeGetOriginalProfile(
57 long nativeProfileAndroid);
58 private native Object nativeGetOffTheRecordProfile(
59 long nativeProfileAndroid);
60 private native boolean nativeHasOffTheRecordProfile(
61 long nativeProfileAndroid);
62 private native boolean nativeIsOffTheRecord(
63 long nativeProfileAndroid);