OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" | 5 #include "chrome/browser/chromeos/login/signin/token_handle_fetcher.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" | 8 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" |
9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 35 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
36 } | 36 } |
37 ~ShutdownNotifierFactory() override {} | 37 ~ShutdownNotifierFactory() override {} |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); | 39 DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 TokenHandleFetcher::TokenHandleFetcher(TokenHandleUtil* util, | 44 TokenHandleFetcher::TokenHandleFetcher(TokenHandleUtil* util, |
45 const user_manager::UserID& user_id) | 45 const AccountId& user_id) |
achuithb
2015/10/23 00:08:50
account_id
Alexander Alekseev
2015/10/23 09:11:22
Done.
| |
46 : OAuth2TokenService::Consumer("user_session_manager"), | 46 : OAuth2TokenService::Consumer("user_session_manager"), |
47 token_handle_util_(util), | 47 token_handle_util_(util), |
48 user_id_(user_id), | 48 user_id_(user_id), |
49 token_service_(nullptr), | 49 token_service_(nullptr), |
achuithb
2015/10/23 00:08:50
You could move this initialization to the header f
Alexander Alekseev
2015/10/23 09:11:22
Done.
| |
50 waiting_for_refresh_token_(false), | 50 waiting_for_refresh_token_(false), |
51 profile_(nullptr), | 51 profile_(nullptr), |
52 tokeninfo_response_start_time_(base::TimeTicks()) { | 52 tokeninfo_response_start_time_(base::TimeTicks()) {} |
53 } | |
54 | 53 |
55 TokenHandleFetcher::~TokenHandleFetcher() { | 54 TokenHandleFetcher::~TokenHandleFetcher() { |
56 if (waiting_for_refresh_token_) | 55 if (waiting_for_refresh_token_) |
57 token_service_->RemoveObserver(this); | 56 token_service_->RemoveObserver(this); |
58 } | 57 } |
59 | 58 |
60 void TokenHandleFetcher::BackfillToken(Profile* profile, | 59 void TokenHandleFetcher::BackfillToken(Profile* profile, |
61 const TokenFetchingCallback& callback) { | 60 const TokenFetchingCallback& callback) { |
62 profile_ = profile; | 61 profile_ = profile; |
63 callback_ = callback; | 62 callback_ = callback; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 } | 147 } |
149 const base::TimeDelta duration = | 148 const base::TimeDelta duration = |
150 base::TimeTicks::Now() - tokeninfo_response_start_time_; | 149 base::TimeTicks::Now() - tokeninfo_response_start_time_; |
151 UMA_HISTOGRAM_TIMES("Login.TokenObtainResponseTime", duration); | 150 UMA_HISTOGRAM_TIMES("Login.TokenObtainResponseTime", duration); |
152 callback_.Run(user_id_, success); | 151 callback_.Run(user_id_, success); |
153 } | 152 } |
154 | 153 |
155 void TokenHandleFetcher::OnProfileDestroyed() { | 154 void TokenHandleFetcher::OnProfileDestroyed() { |
156 callback_.Run(user_id_, false); | 155 callback_.Run(user_id_, false); |
157 } | 156 } |
OLD | NEW |