Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1522)

Side by Side Diff: chrome/browser/sync/internal_api/sync_manager.cc

Issue 9348036: Trim code from sync's ServerConnectionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small updates Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/sync/internal_api/sync_manager.h" 5 #include "chrome/browser/sync/internal_api/sync_manager.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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 674
675 SyncManager::ChangeObserver::~ChangeObserver() {} 675 SyncManager::ChangeObserver::~ChangeObserver() {}
676 676
677 SyncManager::Observer::~Observer() {} 677 SyncManager::Observer::~Observer() {}
678 678
679 SyncManager::SyncManager(const std::string& name) 679 SyncManager::SyncManager(const std::string& name)
680 : data_(new SyncInternal(name)) {} 680 : data_(new SyncInternal(name)) {}
681 681
682 SyncManager::Status::Status() 682 SyncManager::Status::Status()
683 : summary(INVALID), 683 : summary(INVALID),
684 authenticated(false),
685 server_up(false),
686 server_reachable(false),
687 notifications_enabled(false), 684 notifications_enabled(false),
688 notifications_received(0), 685 notifications_received(0),
689 unsynced_count(0), 686 unsynced_count(0),
690 conflicting_count(0), 687 conflicting_count(0),
691 committed_count(0), 688 committed_count(0),
692 syncing(false), 689 syncing(false),
693 initial_sync_ended(false), 690 initial_sync_ended(false),
694 updates_available(0), 691 updates_available(0),
695 updates_received(0), 692 updates_received(0),
696 tombstone_updates_received(0), 693 tombstone_updates_received(0),
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 DCHECK_EQ(credentials.email, share_.name); 1144 DCHECK_EQ(credentials.email, share_.name);
1148 DCHECK(!credentials.email.empty()); 1145 DCHECK(!credentials.email.empty());
1149 DCHECK(!credentials.sync_token.empty()); 1146 DCHECK(!credentials.sync_token.empty());
1150 1147
1151 observing_ip_address_changes_ = true; 1148 observing_ip_address_changes_ = true;
1152 if (connection_manager()->set_auth_token(credentials.sync_token)) { 1149 if (connection_manager()->set_auth_token(credentials.sync_token)) {
1153 sync_notifier_->UpdateCredentials( 1150 sync_notifier_->UpdateCredentials(
1154 credentials.email, credentials.sync_token); 1151 credentials.email, credentials.sync_token);
1155 if (!setup_for_test_mode_ && initialized_) { 1152 if (!setup_for_test_mode_ && initialized_) {
1156 if (scheduler()) 1153 if (scheduler())
1157 scheduler()->OnCredentialsUpdated(); 1154 scheduler()->OnServerConnectionErrorFixed();
rlarocque 2012/02/08 01:57:29 This bypasses the check of "connection_code_ == SY
1158 } 1155 }
1159 } 1156 }
1160 } 1157 }
1161 1158
1162 void SyncManager::SyncInternal::UpdateEnabledTypes() { 1159 void SyncManager::SyncInternal::UpdateEnabledTypes() {
1163 DCHECK(thread_checker_.CalledOnValidThread()); 1160 DCHECK(thread_checker_.CalledOnValidThread());
1164 ModelSafeRoutingInfo routes; 1161 ModelSafeRoutingInfo routes;
1165 registrar_->GetModelSafeRoutingInfo(&routes); 1162 registrar_->GetModelSafeRoutingInfo(&routes);
1166 const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); 1163 const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes);
1167 sync_notifier_->UpdateEnabledTypes(enabled_types); 1164 sync_notifier_->UpdateEnabledTypes(enabled_types);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 base::Bind(&SyncInternal::OnIPAddressChangedImpl, 1711 base::Bind(&SyncInternal::OnIPAddressChangedImpl,
1715 weak_ptr_factory_.GetWeakPtr()), 1712 weak_ptr_factory_.GetWeakPtr()),
1716 kChromeOSNetworkChangeReactionDelayHackMsec); 1713 kChromeOSNetworkChangeReactionDelayHackMsec);
1717 #else 1714 #else
1718 OnIPAddressChangedImpl(); 1715 OnIPAddressChangedImpl();
1719 #endif // defined(OS_CHROMEOS) 1716 #endif // defined(OS_CHROMEOS)
1720 } 1717 }
1721 1718
1722 void SyncManager::SyncInternal::OnIPAddressChangedImpl() { 1719 void SyncManager::SyncInternal::OnIPAddressChangedImpl() {
1723 DCHECK(thread_checker_.CalledOnValidThread()); 1720 DCHECK(thread_checker_.CalledOnValidThread());
1724 if (scheduler()) 1721
1725 scheduler()->OnConnectionStatusChange(); 1722 if (scheduler() && (connection_manager()->server_status() ==
1723 browser_sync::HttpResponse::CONNECTION_UNAVAILABLE)) {
rlarocque 2012/02/08 01:57:29 I've moved the check of the most recent server_sta
1724 scheduler()->OnServerConnectionErrorFixed();
1725 }
1726 } 1726 }
1727 1727
1728 void SyncManager::SyncInternal::OnServerConnectionEvent( 1728 void SyncManager::SyncInternal::OnServerConnectionEvent(
1729 const ServerConnectionEvent& event) { 1729 const ServerConnectionEvent& event) {
1730 DCHECK(thread_checker_.CalledOnValidThread()); 1730 DCHECK(thread_checker_.CalledOnValidThread());
1731 allstatus_.HandleServerConnectionEvent(event);
1732 if (event.connection_code == 1731 if (event.connection_code ==
1733 browser_sync::HttpResponse::SERVER_CONNECTION_OK) { 1732 browser_sync::HttpResponse::SERVER_CONNECTION_OK) {
1734 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, 1733 FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
1735 OnAuthError(AuthError::None())); 1734 OnAuthError(AuthError::None()));
1736 } 1735 }
1737 1736
1738 if (event.connection_code == browser_sync::HttpResponse::SYNC_AUTH_ERROR) { 1737 if (event.connection_code == browser_sync::HttpResponse::SYNC_AUTH_ERROR) {
1739 observing_ip_address_changes_ = false; 1738 observing_ip_address_changes_ = false;
1740 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, 1739 FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
1741 OnAuthError(AuthError(AuthError::INVALID_GAIA_CREDENTIALS))); 1740 OnAuthError(AuthError(AuthError::INVALID_GAIA_CREDENTIALS)));
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 lookup->GetDownloadProgress(i.Get(), &marker); 2499 lookup->GetDownloadProgress(i.Get(), &marker);
2501 2500
2502 if (marker.token().empty()) 2501 if (marker.token().empty())
2503 result.Put(i.Get()); 2502 result.Put(i.Get());
2504 2503
2505 } 2504 }
2506 return result; 2505 return result;
2507 } 2506 }
2508 2507
2509 } // namespace sync_api 2508 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698