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/signin/mutable_profile_oauth2_token_service_delegate.h" | 5 #include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 loading_primary_account_id_ = primary_account_id; | 265 loading_primary_account_id_ = primary_account_id; |
266 } | 266 } |
267 | 267 |
268 scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase(); | 268 scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase(); |
269 if (token_web_data.get()) | 269 if (token_web_data.get()) |
270 web_data_service_request_ = token_web_data->GetAllTokens(this); | 270 web_data_service_request_ = token_web_data->GetAllTokens(this); |
271 } | 271 } |
272 | 272 |
273 void MutableProfileOAuth2TokenServiceDelegate::OnWebDataServiceRequestDone( | 273 void MutableProfileOAuth2TokenServiceDelegate::OnWebDataServiceRequestDone( |
274 WebDataServiceBase::Handle handle, | 274 WebDataServiceBase::Handle handle, |
275 const WDTypedResult* result) { | 275 std::unique_ptr<WDTypedResult> result) { |
276 VLOG(1) << "MutablePO2TS::OnWebDataServiceRequestDone. Result type: " | 276 VLOG(1) << "MutablePO2TS::OnWebDataServiceRequestDone. Result type: " |
277 << (result == nullptr ? -1 : (int)result->GetType()); | 277 << (result.get() == nullptr ? -1 : (int)result->GetType()); |
278 | 278 |
279 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 279 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
280 // fixed. | 280 // fixed. |
281 tracked_objects::ScopedTracker tracking_profile( | 281 tracked_objects::ScopedTracker tracking_profile( |
282 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 282 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
283 "422460 MutableProfileOAuth2Token...::OnWebDataServiceRequestDone")); | 283 "422460 MutableProfileOAuth2Token...::OnWebDataServiceRequestDone")); |
284 | 284 |
285 DCHECK_EQ(web_data_service_request_, handle); | 285 DCHECK_EQ(web_data_service_request_, handle); |
286 web_data_service_request_ = 0; | 286 web_data_service_request_ = 0; |
287 | 287 |
288 if (result) { | 288 if (result) { |
289 DCHECK(result->GetType() == TOKEN_RESULT); | 289 DCHECK(result->GetType() == TOKEN_RESULT); |
290 const WDResult<std::map<std::string, std::string>>* token_result = | 290 const WDResult<std::map<std::string, std::string>>* token_result = |
291 static_cast<const WDResult<std::map<std::string, std::string>>*>( | 291 static_cast<const WDResult<std::map<std::string, std::string>>*>( |
292 result); | 292 result.get()); |
293 LoadAllCredentialsIntoMemory(token_result->GetValue()); | 293 LoadAllCredentialsIntoMemory(token_result->GetValue()); |
294 } | 294 } |
295 | 295 |
296 // Make sure that we have an entry for |loading_primary_account_id_| in the | 296 // Make sure that we have an entry for |loading_primary_account_id_| in the |
297 // map. The entry could be missing if there is a corruption in the token DB | 297 // map. The entry could be missing if there is a corruption in the token DB |
298 // while this profile is connected to an account. | 298 // while this profile is connected to an account. |
299 DCHECK(!loading_primary_account_id_.empty()); | 299 DCHECK(!loading_primary_account_id_.empty()); |
300 if (refresh_tokens_.count(loading_primary_account_id_) == 0) { | 300 if (refresh_tokens_.count(loading_primary_account_id_) == 0) { |
301 refresh_tokens_[loading_primary_account_id_].reset(new AccountStatus( | 301 refresh_tokens_[loading_primary_account_id_].reset(new AccountStatus( |
302 signin_error_controller_, loading_primary_account_id_, std::string())); | 302 signin_error_controller_, loading_primary_account_id_, std::string())); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 net::NetworkChangeNotifier::ConnectionType type) { | 525 net::NetworkChangeNotifier::ConnectionType type) { |
526 // If our network has changed, reset the backoff timer so that errors caused | 526 // If our network has changed, reset the backoff timer so that errors caused |
527 // by a previous lack of network connectivity don't prevent new requests. | 527 // by a previous lack of network connectivity don't prevent new requests. |
528 backoff_entry_.Reset(); | 528 backoff_entry_.Reset(); |
529 } | 529 } |
530 | 530 |
531 const net::BackoffEntry* | 531 const net::BackoffEntry* |
532 MutableProfileOAuth2TokenServiceDelegate::BackoffEntry() const { | 532 MutableProfileOAuth2TokenServiceDelegate::BackoffEntry() const { |
533 return &backoff_entry_; | 533 return &backoff_entry_; |
534 } | 534 } |
OLD | NEW |