aeff4b7beb6b1a2f74f72830dad210edc4dd58cf
[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     @CalledByNative
25     private static Profile create(long nativeProfileAndroid) {
26         return new Profile(nativeProfileAndroid);
27     }
28
29     @CalledByNative
30     private void destroy() {
31         mNativeProfileAndroid = 0;
32     }
33
34     @CalledByNative
35     private long getNativePointer() {
36         return mNativeProfileAndroid;
37     }
38
39     private static native Object nativeGetLastUsedProfile();
40 }