Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/profiles/profile_android.h

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 13
14 class Profile; 14 class Profile;
15 15
16 // Android wrapper around profile that provides safer passage from java and 16 // Android wrapper around profile that provides safer passage from java and
17 // back to native. 17 // back to native.
18 class ProfileAndroid : public base::SupportsUserData::Data { 18 class ProfileAndroid : public base::SupportsUserData::Data {
19 public: 19 public:
20 static ProfileAndroid* FromProfile(Profile* profile); 20 static ProfileAndroid* FromProfile(Profile* profile);
21 static Profile* FromProfileAndroid(jobject obj); 21 static Profile* FromProfileAndroid(jobject obj);
22 static bool RegisterProfileAndroid(JNIEnv* env); 22 static bool RegisterProfileAndroid(JNIEnv* env);
23 23
24 static jobject GetLastUsedProfile(JNIEnv* env, jclass clazz); 24 static base::android::ScopedJavaLocalRef<jobject> GetLastUsedProfile(
25 JNIEnv* env,
26 jclass clazz);
25 27
26 // Destroys this Profile when possible. 28 // Destroys this Profile when possible.
27 void DestroyWhenAppropriate(JNIEnv* env, jobject obj); 29 void DestroyWhenAppropriate(JNIEnv* env, jobject obj);
28 30
29 // Return the original profile. 31 // Return the original profile.
30 base::android::ScopedJavaLocalRef<jobject> GetOriginalProfile( 32 base::android::ScopedJavaLocalRef<jobject> GetOriginalProfile(
31 JNIEnv* env, jobject obj); 33 JNIEnv* env, jobject obj);
32 34
33 // Return the incognito profile. 35 // Return the incognito profile.
34 // 36 //
(...skipping 13 matching lines...) Expand all
48 ~ProfileAndroid() override; 50 ~ProfileAndroid() override;
49 51
50 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); 52 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
51 53
52 private: 54 private:
53 Profile* profile_; // weak 55 Profile* profile_; // weak
54 base::android::ScopedJavaGlobalRef<jobject> obj_; 56 base::android::ScopedJavaGlobalRef<jobject> obj_;
55 }; 57 };
56 58
57 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_ 59 #endif // CHROME_BROWSER_PROFILES_PROFILE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698