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

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

Issue 213823004: Calls FireRefreshTokenRevoked if an account is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments + tests Created 6 years, 8 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_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
6 #define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 6 #define CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 // Returns a reference to the Java instance of this service. 35 // Returns a reference to the Java instance of this service.
36 static jobject GetForProfile( 36 static jobject GetForProfile(
37 JNIEnv* env, jclass clazz, jobject j_profile_android); 37 JNIEnv* env, jclass clazz, jobject j_profile_android);
38 38
39 virtual bool RefreshTokenIsAvailable( 39 virtual bool RefreshTokenIsAvailable(
40 const std::string& account_id) const OVERRIDE; 40 const std::string& account_id) const OVERRIDE;
41 41
42 // Lists account IDs of all accounts with a refresh token. 42 // Lists account IDs of all accounts with a refresh token.
43 virtual std::vector<std::string> GetAccounts() OVERRIDE; 43 virtual std::vector<std::string> GetAccounts() OVERRIDE;
44 44
45 // Lists account at the OS level.
46 std::vector<std::string> GetSystemAccounts();
47
45 void ValidateAccounts(JNIEnv* env, 48 void ValidateAccounts(JNIEnv* env,
46 jobject obj, 49 jobject obj,
47 jobjectArray accounts,
48 jstring current_account); 50 jstring current_account);
49 51
50 // Takes a the signed in sync account as well as all the other 52 // Takes a the signed in sync account as well as all the other
51 // android account ids and check the token status of each. 53 // android account ids and check the token status of each.
52 void ValidateAccounts(const std::string& signed_in_account, 54 void ValidateAccounts(const std::string& signed_in_account);
53 const std::vector<std::string>& account_ids); 55
56 bool ValidateAccounts(const std::string& signed_in_account,
nyquist 2014/04/24 22:27:05 Why is this function public again? It seems to onl
57 const std::vector<std::string>& prev_account_ids,
58 const std::vector<std::string>& curr_account_ids);
54 59
55 // Triggers a notification to all observers of the OAuth2TokenService that a 60 // Triggers a notification to all observers of the OAuth2TokenService that a
56 // refresh token is now available. This may cause observers to retry 61 // refresh token is now available. This may cause observers to retry
57 // operations that require authentication. 62 // operations that require authentication.
58 virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env, 63 virtual void FireRefreshTokenAvailableFromJava(JNIEnv* env,
59 jobject obj, 64 jobject obj,
60 const jstring account_name); 65 const jstring account_name);
61 // Triggers a notification to all observers of the OAuth2TokenService that a 66 // Triggers a notification to all observers of the OAuth2TokenService that a
62 // refresh token is now available. 67 // refresh token is now available.
63 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env, 68 virtual void FireRefreshTokenRevokedFromJava(JNIEnv* env,
64 jobject obj, 69 jobject obj,
65 const jstring account_name); 70 const jstring account_name);
66 // Triggers a notification to all observers of the OAuth2TokenService that all 71 // Triggers a notification to all observers of the OAuth2TokenService that all
67 // refresh tokens have now been loaded. 72 // refresh tokens have now been loaded.
68 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj); 73 virtual void FireRefreshTokensLoadedFromJava(JNIEnv* env, jobject obj);
69 74
75 // Overridden from OAuth2TokenService to complete signout of all
76 // OA2TService aware accounts.
77 virtual void RevokeAllCredentials() OVERRIDE;
78
70 protected: 79 protected:
71 friend class ProfileOAuth2TokenServiceFactory; 80 friend class ProfileOAuth2TokenServiceFactory;
72 AndroidProfileOAuth2TokenService(); 81 AndroidProfileOAuth2TokenService();
73 virtual ~AndroidProfileOAuth2TokenService(); 82 virtual ~AndroidProfileOAuth2TokenService();
74 83
75 // Overridden from OAuth2TokenService to intercept token fetch requests and 84 // Overridden from OAuth2TokenService to intercept token fetch requests and
76 // redirect them to the Account Manager. 85 // redirect them to the Account Manager.
77 virtual void FetchOAuth2Token(RequestImpl* request, 86 virtual void FetchOAuth2Token(RequestImpl* request,
78 const std::string& account_id, 87 const std::string& account_id,
79 net::URLRequestContextGetter* getter, 88 net::URLRequestContextGetter* getter,
(...skipping 24 matching lines...) Expand all
104 // Called to notify observers when refresh tokans have been loaded. 113 // Called to notify observers when refresh tokans have been loaded.
105 virtual void FireRefreshTokensLoaded() OVERRIDE; 114 virtual void FireRefreshTokensLoaded() OVERRIDE;
106 115
107 private: 116 private:
108 base::android::ScopedJavaGlobalRef<jobject> java_ref_; 117 base::android::ScopedJavaGlobalRef<jobject> java_ref_;
109 118
110 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); 119 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService);
111 }; 120 };
112 121
113 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 122 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698