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

Side by Side Diff: chrome/browser/signin/oauth2_token_service_delegate_android.h

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_
6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/android/scoped_java_ref.h"
14 #include "base/callback.h" 13 #include "base/callback.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
16 #include "base/time/time.h" 15 #include "base/time/time.h"
17 #include "components/signin/core/browser/profile_oauth2_token_service.h" 16 #include "components/signin/core/browser/profile_oauth2_token_service.h"
18 #include "google_apis/gaia/google_service_auth_error.h" 17 #include "google_apis/gaia/google_service_auth_error.h"
19 #include "google_apis/gaia/oauth2_token_service_delegate.h" 18 #include "google_apis/gaia/oauth2_token_service_delegate.h"
20 19
21 // A specialization of OAuth2TokenServiceDelegate that will be returned by 20 // A specialization of OAuth2TokenServiceDelegate that will be returned by
22 // OAuth2TokenServiceDelegateFactory for OS_ANDROID. This instance uses 21 // OAuth2TokenServiceDelegateFactory for OS_ANDROID. This instance uses
23 // native Android features to lookup OAuth2 tokens. 22 // native Android features to lookup OAuth2 tokens.
24 // 23 //
25 // See |OAuth2TokenServiceDelegate| for usage details. 24 // See |OAuth2TokenServiceDelegate| for usage details.
26 // 25 //
27 // Note: requests should be started from the UI thread. To start a 26 // Note: requests should be started from the UI thread. To start a
28 // request from other thread, please use OAuth2TokenServiceRequest. 27 // request from other thread, please use OAuth2TokenServiceRequest.
29 class OAuth2TokenServiceDelegateAndroid : public OAuth2TokenServiceDelegate { 28 class OAuth2TokenServiceDelegateAndroid : public OAuth2TokenServiceDelegate {
30 public: 29 public:
31 // Registers the OAuth2TokenServiceDelegateAndroid's native methods through 30 // Registers the OAuth2TokenServiceDelegateAndroid's native methods through
32 // JNI. 31 // JNI.
33 static bool Register(JNIEnv* env); 32 static bool Register(JNIEnv* env);
34 33
35 // Creates a new instance of the OAuth2TokenServiceDelegateAndroid. 34 // Creates a new instance of the OAuth2TokenServiceDelegateAndroid.
36 static OAuth2TokenServiceDelegateAndroid* Create(); 35 static OAuth2TokenServiceDelegateAndroid* Create();
37 36
38 // Returns a reference to the Java instance of this service. 37 // Returns a reference to the Java instance of this service.
39 static base::android::ScopedJavaLocalRef<jobject> 38 static jobject GetForProfile(JNIEnv* env,
40 GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile_android); 39 jclass clazz,
40 jobject j_profile_android);
41 41
42 // Called by the TestingProfile class to disable account validation in 42 // Called by the TestingProfile class to disable account validation in
43 // tests. This prevents the token service from trying to look up system 43 // tests. This prevents the token service from trying to look up system
44 // accounts which requires special permission. 44 // accounts which requires special permission.
45 static void set_is_testing_profile() { is_testing_profile_ = true; } 45 static void set_is_testing_profile() { is_testing_profile_ = true; }
46 46
47 void Initialize(); 47 void Initialize();
48 48
49 // OAuth2TokenServiceDelegate overrides: 49 // OAuth2TokenServiceDelegate overrides:
50 bool RefreshTokenIsAvailable(const std::string& account_id) const override; 50 bool RefreshTokenIsAvailable(const std::string& account_id) const override;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // Maps account_id to the last error for that account. 134 // Maps account_id to the last error for that account.
135 std::map<std::string, ErrorInfo> errors_; 135 std::map<std::string, ErrorInfo> errors_;
136 136
137 static bool is_testing_profile_; 137 static bool is_testing_profile_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid); 139 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceDelegateAndroid);
140 }; 140 };
141 141
142 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ 142 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_android.cc ('k') | chrome/browser/signin/oauth2_token_service_delegate_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698