| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_sync/browser/profile_sync_service.h" | 5 #include "components/browser_sync/browser/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 682 |
| 683 UpdateFirstSyncTimePref(); | 683 UpdateFirstSyncTimePref(); |
| 684 | 684 |
| 685 ReportPreviousSessionMemoryWarningCount(); | 685 ReportPreviousSessionMemoryWarningCount(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 void ProfileSyncService::OnGetTokenSuccess( | 688 void ProfileSyncService::OnGetTokenSuccess( |
| 689 const OAuth2TokenService::Request* request, | 689 const OAuth2TokenService::Request* request, |
| 690 const std::string& access_token, | 690 const std::string& access_token, |
| 691 const base::Time& expiration_time) { | 691 const base::Time& expiration_time) { |
| 692 DCHECK_EQ(access_token_request_, request); | 692 DCHECK_EQ(access_token_request_.get(), request); |
| 693 access_token_request_.reset(); | 693 access_token_request_.reset(); |
| 694 access_token_ = access_token; | 694 access_token_ = access_token; |
| 695 token_receive_time_ = base::Time::Now(); | 695 token_receive_time_ = base::Time::Now(); |
| 696 last_get_token_error_ = GoogleServiceAuthError::AuthErrorNone(); | 696 last_get_token_error_ = GoogleServiceAuthError::AuthErrorNone(); |
| 697 | 697 |
| 698 if (sync_prefs_.SyncHasAuthError()) { | 698 if (sync_prefs_.SyncHasAuthError()) { |
| 699 sync_prefs_.SetSyncAuthError(false); | 699 sync_prefs_.SetSyncAuthError(false); |
| 700 UMA_HISTOGRAM_ENUMERATION("Sync.SyncAuthError", | 700 UMA_HISTOGRAM_ENUMERATION("Sync.SyncAuthError", |
| 701 AUTH_ERROR_FIXED, | 701 AUTH_ERROR_FIXED, |
| 702 AUTH_ERROR_LIMIT); | 702 AUTH_ERROR_LIMIT); |
| 703 } | 703 } |
| 704 | 704 |
| 705 if (HasSyncingBackend()) | 705 if (HasSyncingBackend()) |
| 706 backend_->UpdateCredentials(GetCredentials()); | 706 backend_->UpdateCredentials(GetCredentials()); |
| 707 else | 707 else |
| 708 startup_controller_->TryStart(); | 708 startup_controller_->TryStart(); |
| 709 } | 709 } |
| 710 | 710 |
| 711 void ProfileSyncService::OnGetTokenFailure( | 711 void ProfileSyncService::OnGetTokenFailure( |
| 712 const OAuth2TokenService::Request* request, | 712 const OAuth2TokenService::Request* request, |
| 713 const GoogleServiceAuthError& error) { | 713 const GoogleServiceAuthError& error) { |
| 714 DCHECK_EQ(access_token_request_, request); | 714 DCHECK_EQ(access_token_request_.get(), request); |
| 715 DCHECK_NE(error.state(), GoogleServiceAuthError::NONE); | 715 DCHECK_NE(error.state(), GoogleServiceAuthError::NONE); |
| 716 access_token_request_.reset(); | 716 access_token_request_.reset(); |
| 717 last_get_token_error_ = error; | 717 last_get_token_error_ = error; |
| 718 switch (error.state()) { | 718 switch (error.state()) { |
| 719 case GoogleServiceAuthError::CONNECTION_FAILED: | 719 case GoogleServiceAuthError::CONNECTION_FAILED: |
| 720 case GoogleServiceAuthError::REQUEST_CANCELED: | 720 case GoogleServiceAuthError::REQUEST_CANCELED: |
| 721 case GoogleServiceAuthError::SERVICE_ERROR: | 721 case GoogleServiceAuthError::SERVICE_ERROR: |
| 722 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: { | 722 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: { |
| 723 // Transient error. Retry after some time. | 723 // Transient error. Retry after some time. |
| 724 request_access_token_backoff_.InformOfRequest(false); | 724 request_access_token_backoff_.InformOfRequest(false); |
| (...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 } | 2696 } |
| 2697 | 2697 |
| 2698 std::string ProfileSyncService::unrecoverable_error_message() const { | 2698 std::string ProfileSyncService::unrecoverable_error_message() const { |
| 2699 return unrecoverable_error_message_; | 2699 return unrecoverable_error_message_; |
| 2700 } | 2700 } |
| 2701 | 2701 |
| 2702 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() | 2702 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() |
| 2703 const { | 2703 const { |
| 2704 return unrecoverable_error_location_; | 2704 return unrecoverable_error_location_; |
| 2705 } | 2705 } |
| OLD | NEW |