OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/engine/all_status.h" | 5 #include "chrome/browser/sync/engine/all_status.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/port.h" | 10 #include "base/port.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 void AllStatus::HandleServerConnectionEvent( | 122 void AllStatus::HandleServerConnectionEvent( |
123 const ServerConnectionEvent& event) { | 123 const ServerConnectionEvent& event) { |
124 if (ServerConnectionEvent::STATUS_CHANGED == event.what_happened) { | 124 if (ServerConnectionEvent::STATUS_CHANGED == event.what_happened) { |
125 ScopedStatusLock lock(this); | 125 ScopedStatusLock lock(this); |
126 status_.server_up = IsGoodReplyFromServer(event.connection_code); | 126 status_.server_up = IsGoodReplyFromServer(event.connection_code); |
127 status_.server_reachable = event.server_reachable; | 127 status_.server_reachable = event.server_reachable; |
128 | 128 |
129 if (event.connection_code == HttpResponse::SERVER_CONNECTION_OK) { | 129 if (event.connection_code == HttpResponse::SERVER_CONNECTION_OK) { |
130 if (!status_.authenticated) { | |
131 status_ = CreateBlankStatus(); | |
132 } | |
133 status_.authenticated = true; | 130 status_.authenticated = true; |
134 } else { | 131 } else { |
135 status_.authenticated = false; | 132 status_.authenticated = false; |
136 } | 133 } |
137 } | 134 } |
138 } | 135 } |
139 | 136 |
140 sync_api::SyncManager::Status AllStatus::status() const { | 137 sync_api::SyncManager::Status AllStatus::status() const { |
141 base::AutoLock lock(mutex_); | 138 base::AutoLock lock(mutex_); |
142 return status_; | 139 return status_; |
(...skipping 18 matching lines...) Expand all Loading... |
161 : allstatus_(allstatus) { | 158 : allstatus_(allstatus) { |
162 allstatus->mutex_.Acquire(); | 159 allstatus->mutex_.Acquire(); |
163 } | 160 } |
164 | 161 |
165 ScopedStatusLock::~ScopedStatusLock() { | 162 ScopedStatusLock::~ScopedStatusLock() { |
166 allstatus_->CalcStatusChanges(); | 163 allstatus_->CalcStatusChanges(); |
167 allstatus_->mutex_.Release(); | 164 allstatus_->mutex_.Release(); |
168 } | 165 } |
169 | 166 |
170 } // namespace browser_sync | 167 } // namespace browser_sync |
OLD | NEW |