OLD | NEW |
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 CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Raised when a new OAuth2 refresh token is avaialble. | 72 // Raised when a new OAuth2 refresh token is avaialble. |
73 virtual void OnNewRefreshTokenAvaiable(Profile* user_profile) {} | 73 virtual void OnNewRefreshTokenAvaiable(Profile* user_profile) {} |
74 | 74 |
75 // Raised when session's GAIA credentials (SID+LSID) are available to | 75 // Raised when session's GAIA credentials (SID+LSID) are available to |
76 // other signed in services. | 76 // other signed in services. |
77 virtual void OnSessionAuthenticated(Profile* user_profile) {} | 77 virtual void OnSessionAuthenticated(Profile* user_profile) {} |
78 }; | 78 }; |
79 | 79 |
80 explicit OAuth2LoginManager(Profile* user_profile); | 80 explicit OAuth2LoginManager(Profile* user_profile); |
81 virtual ~OAuth2LoginManager(); | 81 ~OAuth2LoginManager() override; |
82 | 82 |
83 void AddObserver(OAuth2LoginManager::Observer* observer); | 83 void AddObserver(OAuth2LoginManager::Observer* observer); |
84 void RemoveObserver(OAuth2LoginManager::Observer* observer); | 84 void RemoveObserver(OAuth2LoginManager::Observer* observer); |
85 | 85 |
86 // Restores and verifies OAuth tokens either following specified | 86 // Restores and verifies OAuth tokens either following specified |
87 // |restore_strategy|. For |restore_strategy| with values | 87 // |restore_strategy|. For |restore_strategy| with values |
88 // RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN or | 88 // RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN or |
89 // RESTORE_FROM_AUTH_CODE, respectively | 89 // RESTORE_FROM_AUTH_CODE, respectively |
90 // parameters |oauth2_refresh_token| or |auth_code| need to have non-empty | 90 // parameters |oauth2_refresh_token| or |auth_code| need to have non-empty |
91 // value. | 91 // value. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 POST_MERGE_SUCCESS = 1, | 138 POST_MERGE_SUCCESS = 1, |
139 POST_MERGE_NO_ACCOUNTS = 2, | 139 POST_MERGE_NO_ACCOUNTS = 2, |
140 POST_MERGE_MISSING_PRIMARY_ACCOUNT = 3, | 140 POST_MERGE_MISSING_PRIMARY_ACCOUNT = 3, |
141 POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT = 4, | 141 POST_MERGE_PRIMARY_NOT_FIRST_ACCOUNT = 4, |
142 POST_MERGE_VERIFICATION_FAILED = 5, | 142 POST_MERGE_VERIFICATION_FAILED = 5, |
143 POST_MERGE_CONNECTION_FAILED = 6, | 143 POST_MERGE_CONNECTION_FAILED = 6, |
144 POST_MERGE_COUNT = 7, | 144 POST_MERGE_COUNT = 7, |
145 }; | 145 }; |
146 | 146 |
147 // KeyedService implementation. | 147 // KeyedService implementation. |
148 virtual void Shutdown() override; | 148 void Shutdown() override; |
149 | 149 |
150 // gaia::GaiaOAuthClient::Delegate overrides. | 150 // gaia::GaiaOAuthClient::Delegate overrides. |
151 virtual void OnRefreshTokenResponse(const std::string& access_token, | 151 void OnRefreshTokenResponse(const std::string& access_token, |
152 int expires_in_seconds) override; | 152 int expires_in_seconds) override; |
153 virtual void OnGetUserEmailResponse(const std::string& user_email) override; | 153 void OnGetUserEmailResponse(const std::string& user_email) override; |
154 virtual void OnOAuthError() override; | 154 void OnOAuthError() override; |
155 virtual void OnNetworkError(int response_code) override; | 155 void OnNetworkError(int response_code) override; |
156 | 156 |
157 // OAuth2LoginVerifier::Delegate overrides. | 157 // OAuth2LoginVerifier::Delegate overrides. |
158 virtual void OnSessionMergeSuccess() override; | 158 void OnSessionMergeSuccess() override; |
159 virtual void OnSessionMergeFailure(bool connection_error) override; | 159 void OnSessionMergeFailure(bool connection_error) override; |
160 virtual void OnListAccountsSuccess(const std::string& data) override; | 160 void OnListAccountsSuccess(const std::string& data) override; |
161 virtual void OnListAccountsFailure(bool connection_error) override; | 161 void OnListAccountsFailure(bool connection_error) override; |
162 | 162 |
163 // OAuth2TokenFetcher::Delegate overrides. | 163 // OAuth2TokenFetcher::Delegate overrides. |
164 virtual void OnOAuth2TokensAvailable( | 164 void OnOAuth2TokensAvailable( |
165 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override; | 165 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override; |
166 virtual void OnOAuth2TokensFetchFailed() override; | 166 void OnOAuth2TokensFetchFailed() override; |
167 | 167 |
168 // OAuth2TokenService::Observer implementation: | 168 // OAuth2TokenService::Observer implementation: |
169 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; | 169 void OnRefreshTokenAvailable(const std::string& account_id) override; |
170 | 170 |
171 // Signals delegate that authentication is completed, kicks off token fetching | 171 // Signals delegate that authentication is completed, kicks off token fetching |
172 // process. | 172 // process. |
173 void CompleteAuthentication(); | 173 void CompleteAuthentication(); |
174 | 174 |
175 // Retrieves ProfileOAuth2TokenService for |user_profile_|. | 175 // Retrieves ProfileOAuth2TokenService for |user_profile_|. |
176 ProfileOAuth2TokenService* GetTokenService(); | 176 ProfileOAuth2TokenService* GetTokenService(); |
177 | 177 |
178 // Retrieves the primary account for |user_profile_|. | 178 // Retrieves the primary account for |user_profile_|. |
179 const std::string& GetPrimaryAccountId(); | 179 const std::string& GetPrimaryAccountId(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we | 249 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we |
250 // can change the line below to ObserverList<Observer, true>. | 250 // can change the line below to ObserverList<Observer, true>. |
251 ObserverList<Observer, false> observer_list_; | 251 ObserverList<Observer, false> observer_list_; |
252 | 252 |
253 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager); | 253 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager); |
254 }; | 254 }; |
255 | 255 |
256 } // namespace chromeos | 256 } // namespace chromeos |
257 | 257 |
258 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ | 258 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ |
OLD | NEW |