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

Side by Side Diff: components/signin/ios/browser/profile_oauth2_token_service_ios.h

Issue 234573003: Upstream PO2TS_IOS unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_ 5 #ifndef COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_
6 #define COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_ 6 #define COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/threading/thread_checker.h" 10 #include "base/threading/thread_checker.h"
11 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" 11 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h"
12 12
13 class OAuth2AccessTokenFetcher; 13 class OAuth2AccessTokenFetcher;
14 14
15 namespace ios{ 15 namespace ios{
16 class ProfileOAuth2TokenServiceIOSProvider; 16 class ProfileOAuth2TokenServiceIOSProvider;
17 } 17 }
18 18
19 // A specialization of ProfileOAuth2TokenService for OS_IOS. It fetches access 19 // A specialization of ProfileOAuth2TokenService that will be returned by
20 // tokens from the SSOAuth library if the user is signed in using shared 20 // ProfileOAuth2TokenServiceFactory for OS_IOS when iOS authentication service
21 // authentication or defaults to the parent class 21 // is used to lookup OAuth2 tokens.
22 // |MutableProfileOAuth2TokenService| for pre-SSO signed in users.
23 // 22 //
24 // See |ProfileOAuth2TokenService| for usage details. 23 // See |ProfileOAuth2TokenService| for usage details.
24 //
25 // Note: Requests should be started from the UI thread. To start a
26 // request from aother thread, please use ProfileOAuth2TokenServiceRequest.
25 class ProfileOAuth2TokenServiceIOS : public MutableProfileOAuth2TokenService { 27 class ProfileOAuth2TokenServiceIOS : public MutableProfileOAuth2TokenService {
26 public: 28 public:
29 ProfileOAuth2TokenServiceIOS();
27 virtual ~ProfileOAuth2TokenServiceIOS(); 30 virtual ~ProfileOAuth2TokenServiceIOS();
28 31
29 // KeyedService 32 // KeyedService
30 virtual void Shutdown() OVERRIDE; 33 virtual void Shutdown() OVERRIDE;
31 34
32 // OAuth2TokenService 35 // OAuth2TokenService
33 virtual bool RefreshTokenIsAvailable( 36 virtual bool RefreshTokenIsAvailable(
34 const std::string& account_id) const OVERRIDE; 37 const std::string& account_id) const OVERRIDE;
35 38
36 virtual void InvalidateOAuth2Token(const std::string& account_id, 39 virtual void InvalidateOAuth2Token(const std::string& account_id,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void SetUseLegacyTokenServiceForTesting(bool use_legacy_token_service); 80 void SetUseLegacyTokenServiceForTesting(bool use_legacy_token_service);
78 81
79 // Revokes the OAuth2 refresh tokens for all accounts from the parent 82 // Revokes the OAuth2 refresh tokens for all accounts from the parent
80 // |MutableProfileOAuth2TokenService|. 83 // |MutableProfileOAuth2TokenService|.
81 // 84 //
82 // Note: This method should only be called if the legacy pre-SSOAuth token 85 // Note: This method should only be called if the legacy pre-SSOAuth token
83 // service is used. 86 // service is used.
84 void ForceInvalidGrantResponses(); 87 void ForceInvalidGrantResponses();
85 88
86 protected: 89 protected:
87 friend class ProfileOAuth2TokenServiceFactory;
88
89 ProfileOAuth2TokenServiceIOS();
90
91 virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( 90 virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher(
92 const std::string& account_id, 91 const std::string& account_id,
93 net::URLRequestContextGetter* getter, 92 net::URLRequestContextGetter* getter,
94 OAuth2AccessTokenConsumer* consumer) OVERRIDE; 93 OAuth2AccessTokenConsumer* consumer) OVERRIDE;
95 94
96 // Protected and virtual to be overriden by fake for testing. 95 // Protected and virtual to be overriden by fake for testing.
97 96
98 // Adds |account_id| to |accounts_| if it does not exist or udpates 97 // Adds |account_id| to |accounts_| if it does not exist or udpates
99 // the auth error state of |account_id| if it exists. Fires 98 // the auth error state of |account_id| if it exists. Fires
100 // |OnRefreshTokenAvailable| if the account info is updated. 99 // |OnRefreshTokenAvailable| if the account info is updated.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // 153 //
155 // If |use_legacy_token_service_| is true, then this 154 // If |use_legacy_token_service_| is true, then this
156 // |ProfileOAuth2TokenServiceIOS| delegates all calls to the parent 155 // |ProfileOAuth2TokenServiceIOS| delegates all calls to the parent
157 // |MutableProfileOAuth2TokenService|. 156 // |MutableProfileOAuth2TokenService|.
158 bool use_legacy_token_service_; 157 bool use_legacy_token_service_;
159 158
160 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceIOS); 159 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceIOS);
161 }; 160 };
162 161
163 #endif // COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_ 162 #endif // COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_H_
OLDNEW
« no previous file with comments | « components/signin/ios/DEPS ('k') | components/signin/ios/browser/profile_oauth2_token_service_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698