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

Unified Diff: chrome/browser/sync/engine/syncapi.cc

Issue 7530023: sync: Disable network change notifications for unauthenticated users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncapi.cc
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index e7159479e689c51dfc8ed0e99440d299fae6f5eb..647e68a5d758de274964d99bf94163895c125677 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -1201,6 +1201,7 @@ class SyncManager::SyncInternal
registrar_(NULL),
initialized_(false),
setup_for_test_mode_(false),
+ observing_ip_address_changes_(false),
js_transaction_observer_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
// Pre-fill |notification_info_map_|.
for (int i = syncable::FIRST_REAL_MODEL_TYPE;
@@ -1627,6 +1628,10 @@ class SyncManager::SyncInternal
// scheduler actually communicating with the server).
bool setup_for_test_mode_;
+ // TODO(tim): Trying to debug 401-request-loop, temporarily adding this
lipalani1 2011/07/29 02:30:38 Not sure if this stmt is needed. This looks like a
+ // line to see if it makes a difference.
+ bool observing_ip_address_changes_;
+
// Map used to store the notification info to be displayed in
// about:sync page.
NotificationInfoMap notification_info_map_;
@@ -1770,6 +1775,7 @@ bool SyncManager::SyncInternal::Init(
sync_server_and_path, port, use_ssl, user_agent, post_factory));
net::NetworkChangeNotifier::AddIPAddressObserver(this);
+ observing_ip_address_changes_ = true;
connection_manager()->AddListener(this);
@@ -1941,6 +1947,8 @@ void SyncManager::SyncInternal::UpdateCredentials(
DCHECK_EQ(credentials.email, share_.name);
DCHECK(!credentials.email.empty());
DCHECK(!credentials.sync_token.empty());
+
+ observing_ip_address_changes_ = true;
connection_manager()->set_auth_token(credentials.sync_token);
sync_notifier_->UpdateCredentials(
credentials.email, credentials.sync_token);
@@ -2237,6 +2245,7 @@ void SyncManager::SyncInternal::Shutdown() {
connection_manager_.reset();
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
+ observing_ip_address_changes_ = false;
if (dir_manager()) {
dir_manager()->FinalSaveChangesForAll();
@@ -2260,6 +2269,9 @@ void SyncManager::SyncInternal::Shutdown() {
void SyncManager::SyncInternal::OnIPAddressChanged() {
VLOG(1) << "IP address change detected";
+ if (!observing_ip_address_changes_)
lipalani1 2011/07/29 02:30:38 Can you add a log stmt here to say that it was dro
+ return;
+
#if defined (OS_CHROMEOS)
// TODO(tim): This is a hack to intentionally lose a race with flimflam at
// shutdown, so we don't cause shutdown to wait for our http request.
@@ -2292,6 +2304,7 @@ void SyncManager::SyncInternal::OnServerConnectionEvent(
}
if (event.connection_code == browser_sync::HttpResponse::SYNC_AUTH_ERROR) {
+ observing_ip_address_changes_ = false;
ObserverList<SyncManager::Observer> temp_obs_list;
CopyObservers(&temp_obs_list);
FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698