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

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

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to include the update to ProfileSyncService: r224220 Created 7 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_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 10 matching lines...) Expand all
21 // A specialization of ProfileOAuth2TokenService that will be returned by 21 // A specialization of ProfileOAuth2TokenService that will be returned by
22 // ProfileOAuth2TokenServiceFactory for OS_ANDROID. This instance uses 22 // ProfileOAuth2TokenServiceFactory for OS_ANDROID. This instance uses
23 // native Android features to lookup OAuth2 tokens. 23 // native Android features to lookup OAuth2 tokens.
24 // 24 //
25 // See |ProfileOAuth2TokenService| for usage details. 25 // See |ProfileOAuth2TokenService| for usage details.
26 // 26 //
27 // Note: requests should be started from the UI thread. To start a 27 // Note: requests should be started from the UI thread. To start a
28 // request from other thread, please use ProfileOAuth2TokenServiceRequest. 28 // request from other thread, please use ProfileOAuth2TokenServiceRequest.
29 class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService { 29 class AndroidProfileOAuth2TokenService : public ProfileOAuth2TokenService {
30 public: 30 public:
31 // StartRequest() fetches a token for the currently signed-in account; this 31 virtual bool RefreshTokenIsAvailable(
32 // version uses the account corresponding to |username|. This allows fetching 32 const std::string& account_id) OVERRIDE;
33 // tokens before a user is signed-in (e.g. during the sign-in flow).
34 scoped_ptr<OAuth2TokenService::Request> StartRequestForUsername(
35 const std::string& username,
36 const OAuth2TokenService::ScopeSet& scopes,
37 OAuth2TokenService::Consumer* consumer);
38
39 virtual bool RefreshTokenIsAvailable() OVERRIDE;
40 virtual void InvalidateToken(const ScopeSet& scopes,
41 const std::string& invalid_token) OVERRIDE;
42 33
43 // Registers the AndroidProfileOAuth2TokenService's native methods through 34 // Registers the AndroidProfileOAuth2TokenService's native methods through
44 // JNI. 35 // JNI.
45 static bool Register(JNIEnv* env); 36 static bool Register(JNIEnv* env);
46 37
38 // Lists account IDs of all accounts with a refresh token.
39 virtual std::vector<std::string> GetAccounts() OVERRIDE;
40
47 protected: 41 protected:
48 friend class ProfileOAuth2TokenServiceFactory; 42 friend class ProfileOAuth2TokenServiceFactory;
49 AndroidProfileOAuth2TokenService(); 43 AndroidProfileOAuth2TokenService();
50 virtual ~AndroidProfileOAuth2TokenService(); 44 virtual ~AndroidProfileOAuth2TokenService();
51 45
52 // Overridden from OAuth2TokenService to intercept token fetch requests and 46 // Overridden from OAuth2TokenService to intercept token fetch requests and
53 // redirect them to the Account Manager. 47 // redirect them to the Account Manager.
54 virtual void FetchOAuth2Token(RequestImpl* request, 48 virtual void FetchOAuth2Token(RequestImpl* request,
49 const std::string& account_id,
55 net::URLRequestContextGetter* getter, 50 net::URLRequestContextGetter* getter,
56 const std::string& client_id, 51 const std::string& client_id,
57 const std::string& client_secret, 52 const std::string& client_secret,
58 const ScopeSet& scopes) OVERRIDE; 53 const ScopeSet& scopes) OVERRIDE;
59 54
60 // Low-level helper function used by both FetchOAuth2Token and 55 // Overridden from OAuth2TokenService to intercept token fetch requests and
61 // StartRequestForUsername to fetch tokens. virtual to enable mocks. 56 // redirect them to the Account Manager.
62 virtual void FetchOAuth2TokenWithUsername( 57 virtual void InvalidateOAuth2Token(const std::string& account_id,
63 RequestImpl* request, 58 const std::string& client_id,
64 const std::string& username, 59 const ScopeSet& scopes,
65 const ScopeSet& scope); 60 const std::string& access_token) OVERRIDE;
66 61
67 private: 62 private:
68 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService); 63 DISALLOW_COPY_AND_ASSIGN(AndroidProfileOAuth2TokenService);
69 }; 64 };
70 65
71 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 66 #endif // CHROME_BROWSER_SIGNIN_ANDROID_PROFILE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_downloader.cc ('k') | chrome/browser/signin/android_profile_oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698