Chromium Code Reviews| 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 "sync/internal_api/sync_manager_impl.h" | 5 #include "sync/internal_api/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 << ModelTypeSetToString(disabled_types); | 590 << ModelTypeSetToString(disabled_types); |
| 591 return directory()->PurgeEntriesWithTypeIn(disabled_types, failed_types); | 591 return directory()->PurgeEntriesWithTypeIn(disabled_types, failed_types); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) { | 594 void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) { |
| 595 DCHECK(thread_checker_.CalledOnValidThread()); | 595 DCHECK(thread_checker_.CalledOnValidThread()); |
| 596 DCHECK(initialized_); | 596 DCHECK(initialized_); |
| 597 DCHECK(!credentials.email.empty()); | 597 DCHECK(!credentials.email.empty()); |
| 598 DCHECK(!credentials.sync_token.empty()); | 598 DCHECK(!credentials.sync_token.empty()); |
| 599 | 599 |
| 600 observing_network_connectivity_changes_ = true; | |
| 601 if (!connection_manager_->set_auth_token(credentials.sync_token)) | 600 if (!connection_manager_->set_auth_token(credentials.sync_token)) |
| 602 return; // Auth token is known to be invalid, so exit early. | 601 return; // Auth token is known to be invalid, so exit early. |
| 603 | 602 |
| 603 if (connection_manager_->server_status() == HttpResponse::SYNC_AUTH_ERROR) | |
| 604 connection_manager_->SetServerStatus(HttpResponse::TOKEN_REFRESHED); | |
| 605 | |
|
Andrew T Wilson (Slow)
2013/05/24 14:10:15
Hmm. I'm not sure why it's safe to move "observing
pavely
2013/05/30 07:42:12
if(set_auth_token) condition means "New credential
| |
| 606 observing_network_connectivity_changes_ = true; | |
| 607 | |
| 604 invalidator_->UpdateCredentials(credentials.email, credentials.sync_token); | 608 invalidator_->UpdateCredentials(credentials.email, credentials.sync_token); |
| 605 scheduler_->OnCredentialsUpdated(); | 609 scheduler_->OnCredentialsUpdated(); |
| 606 } | 610 } |
| 607 | 611 |
| 608 void SyncManagerImpl::UpdateEnabledTypes(ModelTypeSet enabled_types) { | 612 void SyncManagerImpl::UpdateEnabledTypes(ModelTypeSet enabled_types) { |
| 609 DCHECK(thread_checker_.CalledOnValidThread()); | 613 DCHECK(thread_checker_.CalledOnValidThread()); |
| 610 DCHECK(initialized_); | 614 DCHECK(initialized_); |
| 611 invalidator_->UpdateRegisteredIds( | 615 invalidator_->UpdateRegisteredIds( |
| 612 this, | 616 this, |
| 613 ModelTypeSetToObjectIdSet(enabled_types)); | 617 ModelTypeSetToObjectIdSet(enabled_types)); |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1394 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1398 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1395 return kDefaultNudgeDelayMilliseconds; | 1399 return kDefaultNudgeDelayMilliseconds; |
| 1396 } | 1400 } |
| 1397 | 1401 |
| 1398 // static. | 1402 // static. |
| 1399 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1403 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1400 return kPreferencesNudgeDelayMilliseconds; | 1404 return kPreferencesNudgeDelayMilliseconds; |
| 1401 } | 1405 } |
| 1402 | 1406 |
| 1403 } // namespace syncer | 1407 } // namespace syncer |
| OLD | NEW |