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 #include "components/signin/core/browser/account_tracker_service.h" | 5 #include "components/signin/core/browser/account_tracker_service.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/profiler/scoped_profile.h" | 10 #include "base/profiler/scoped_profile.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 } | 26 } |
27 | 27 |
28 class AccountInfoFetcher : public OAuth2TokenService::Consumer, | 28 class AccountInfoFetcher : public OAuth2TokenService::Consumer, |
29 public gaia::GaiaOAuthClient::Delegate { | 29 public gaia::GaiaOAuthClient::Delegate { |
30 public: | 30 public: |
31 AccountInfoFetcher(OAuth2TokenService* token_service, | 31 AccountInfoFetcher(OAuth2TokenService* token_service, |
32 net::URLRequestContextGetter* request_context_getter, | 32 net::URLRequestContextGetter* request_context_getter, |
33 AccountTrackerService* service, | 33 AccountTrackerService* service, |
34 const std::string& account_id); | 34 const std::string& account_id); |
35 virtual ~AccountInfoFetcher(); | 35 ~AccountInfoFetcher() override; |
36 | 36 |
37 const std::string& account_id() { return account_id_; } | 37 const std::string& account_id() { return account_id_; } |
38 | 38 |
39 void Start(); | 39 void Start(); |
40 | 40 |
41 // OAuth2TokenService::Consumer implementation. | 41 // OAuth2TokenService::Consumer implementation. |
42 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 42 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
43 const std::string& access_token, | 43 const std::string& access_token, |
44 const base::Time& expiration_time) override; | 44 const base::Time& expiration_time) override; |
45 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 45 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
46 const GoogleServiceAuthError& error) override; | 46 const GoogleServiceAuthError& error) override; |
47 | 47 |
48 // gaia::GaiaOAuthClient::Delegate implementation. | 48 // gaia::GaiaOAuthClient::Delegate implementation. |
49 virtual void OnGetUserInfoResponse( | 49 void OnGetUserInfoResponse( |
50 scoped_ptr<base::DictionaryValue> user_info) override; | 50 scoped_ptr<base::DictionaryValue> user_info) override; |
51 virtual void OnOAuthError() override; | 51 void OnOAuthError() override; |
52 virtual void OnNetworkError(int response_code) override; | 52 void OnNetworkError(int response_code) override; |
53 | 53 |
54 private: | 54 private: |
55 OAuth2TokenService* token_service_; | 55 OAuth2TokenService* token_service_; |
56 net::URLRequestContextGetter* request_context_getter_; | 56 net::URLRequestContextGetter* request_context_getter_; |
57 AccountTrackerService* service_; | 57 AccountTrackerService* service_; |
58 const std::string account_id_; | 58 const std::string account_id_; |
59 | 59 |
60 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 60 scoped_ptr<OAuth2TokenService::Request> login_token_request_; |
61 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 61 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
62 }; | 62 }; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 void AccountTrackerService::LoadFromTokenService() { | 444 void AccountTrackerService::LoadFromTokenService() { |
445 std::vector<std::string> accounts = token_service_->GetAccounts(); | 445 std::vector<std::string> accounts = token_service_->GetAccounts(); |
446 for (std::vector<std::string>::const_iterator it = accounts.begin(); | 446 for (std::vector<std::string>::const_iterator it = accounts.begin(); |
447 it != accounts.end(); ++it) { | 447 it != accounts.end(); ++it) { |
448 OnRefreshTokenAvailable(*it); | 448 OnRefreshTokenAvailable(*it); |
449 } | 449 } |
450 } | 450 } |
OLD | NEW |