Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / chrome / android / java / src / org / chromium / chrome / browser / profiles / Profile.java
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.
4
5 package org.chromium.chrome.browser.profiles;
6
7 import org.chromium.base.CalledByNative;
8
9 /**
10  * Wrapper that allows passing a Profile reference around in the Java layer.
11  */
12 public class Profile {
13
14     private long mNativeProfileAndroid;
15
16     private Profile(long nativeProfileAndroid) {
17         mNativeProfileAndroid = nativeProfileAndroid;
18     }
19
20     public static Profile getLastUsedProfile() {
21         return (Profile) nativeGetLastUsedProfile();
22     }
23
24     public Profile getOriginalProfile() {
25         return (Profile) nativeGetOriginalProfile(mNativeProfileAndroid);
26     }
27
28     public Profile getOffTheRecordProfile() {
29         return (Profile) nativeGetOffTheRecordProfile(mNativeProfileAndroid);
30     }
31
32     public boolean hasOffTheRecordProfile() {
33         return nativeHasOffTheRecordProfile(mNativeProfileAndroid);
34     }
35
36     public boolean isOffTheRecord() {
37         return nativeIsOffTheRecord(mNativeProfileAndroid);
38     }
39
40     @CalledByNative
41     private static Profile create(long nativeProfileAndroid) {
42         return new Profile(nativeProfileAndroid);
43     }
44
45     @CalledByNative
46     private void destroy() {
47         mNativeProfileAndroid = 0;
48     }
49
50     @CalledByNative
51     private long getNativePointer() {
52         return mNativeProfileAndroid;
53     }
54
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);
64 }