| 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 "chrome/browser/sync/glue/password_change_processor.h" | 5 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PasswordChangeProcessor::CommitChangesFromSyncModel() { | 218 void PasswordChangeProcessor::CommitChangesFromSyncModel() { |
| 219 DCHECK(expected_loop_ == MessageLoop::current()); | 219 DCHECK(expected_loop_ == MessageLoop::current()); |
| 220 if (!running()) | 220 if (!running()) |
| 221 return; | 221 return; |
| 222 ScopedStopObserving<PasswordChangeProcessor> stop_observing(this); | 222 ScopedStopObserving<PasswordChangeProcessor> stop_observing(this); |
| 223 | 223 |
| 224 if (!model_associator_->WriteToPasswordStore(&new_passwords_, | 224 SyncError error = model_associator_->WriteToPasswordStore( |
| 225 &updated_passwords_, | 225 &new_passwords_, |
| 226 &deleted_passwords_)) { | 226 &updated_passwords_, |
| 227 &deleted_passwords_); |
| 228 if (error.IsSet()) { |
| 227 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, | 229 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
| 228 "Error writing passwords"); | 230 "Error writing passwords"); |
| 229 return; | 231 return; |
| 230 } | 232 } |
| 231 | 233 |
| 232 deleted_passwords_.clear(); | 234 deleted_passwords_.clear(); |
| 233 new_passwords_.clear(); | 235 new_passwords_.clear(); |
| 234 updated_passwords_.clear(); | 236 updated_passwords_.clear(); |
| 235 } | 237 } |
| 236 | 238 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 254 | 256 |
| 255 void PasswordChangeProcessor::StopObserving() { | 257 void PasswordChangeProcessor::StopObserving() { |
| 256 DCHECK(expected_loop_ == MessageLoop::current()); | 258 DCHECK(expected_loop_ == MessageLoop::current()); |
| 257 notification_registrar_.Remove( | 259 notification_registrar_.Remove( |
| 258 this, | 260 this, |
| 259 chrome::NOTIFICATION_LOGINS_CHANGED, | 261 chrome::NOTIFICATION_LOGINS_CHANGED, |
| 260 content::Source<PasswordStore>(password_store_)); | 262 content::Source<PasswordStore>(password_store_)); |
| 261 } | 263 } |
| 262 | 264 |
| 263 } // namespace browser_sync | 265 } // namespace browser_sync |
| OLD | NEW |