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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (!observing_) | 61 if (!observing_) |
62 return; | 62 return; |
63 | 63 |
64 DCHECK(running()); | 64 DCHECK(running()); |
65 | 65 |
66 sync_api::WriteTransaction trans(FROM_HERE, share_handle()); | 66 sync_api::WriteTransaction trans(FROM_HERE, share_handle()); |
67 | 67 |
68 sync_api::ReadNode password_root(&trans); | 68 sync_api::ReadNode password_root(&trans); |
69 if (password_root.InitByTagLookup(kPasswordTag) != | 69 if (password_root.InitByTagLookup(kPasswordTag) != |
70 sync_api::BaseNode::INIT_OK) { | 70 sync_api::BaseNode::INIT_OK) { |
71 error_handler()->OnUnrecoverableError(FROM_HERE, | 71 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
72 "Server did not create the top-level password node. " | 72 "Server did not create the top-level password node. " |
73 "We might be running against an out-of-date server."); | 73 "We might be running against an out-of-date server."); |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 PasswordStoreChangeList* changes = | 77 PasswordStoreChangeList* changes = |
78 content::Details<PasswordStoreChangeList>(details).ptr(); | 78 content::Details<PasswordStoreChangeList>(details).ptr(); |
79 for (PasswordStoreChangeList::iterator change = changes->begin(); | 79 for (PasswordStoreChangeList::iterator change = changes->begin(); |
80 change != changes->end(); ++change) { | 80 change != changes->end(); ++change) { |
81 std::string tag = PasswordModelAssociator::MakeTag(change->form()); | 81 std::string tag = PasswordModelAssociator::MakeTag(change->form()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void PasswordChangeProcessor::ApplyChangesFromSyncModel( | 167 void PasswordChangeProcessor::ApplyChangesFromSyncModel( |
168 const sync_api::BaseTransaction* trans, | 168 const sync_api::BaseTransaction* trans, |
169 const sync_api::ImmutableChangeRecordList& changes) { | 169 const sync_api::ImmutableChangeRecordList& changes) { |
170 DCHECK(expected_loop_ == MessageLoop::current()); | 170 DCHECK(expected_loop_ == MessageLoop::current()); |
171 if (!running()) | 171 if (!running()) |
172 return; | 172 return; |
173 | 173 |
174 sync_api::ReadNode password_root(trans); | 174 sync_api::ReadNode password_root(trans); |
175 if (password_root.InitByTagLookup(kPasswordTag) != | 175 if (password_root.InitByTagLookup(kPasswordTag) != |
176 sync_api::BaseNode::INIT_OK) { | 176 sync_api::BaseNode::INIT_OK) { |
177 error_handler()->OnUnrecoverableError(FROM_HERE, | 177 error_handler()->OnSingleDatatypeUnrecoverableError(FROM_HERE, |
178 "Password root node lookup failed."); | 178 "Password root node lookup failed."); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 DCHECK(deleted_passwords_.empty() && new_passwords_.empty() && | 182 DCHECK(deleted_passwords_.empty() && new_passwords_.empty() && |
183 updated_passwords_.empty()); | 183 updated_passwords_.empty()); |
184 | 184 |
185 for (sync_api::ChangeRecordList::const_iterator it = | 185 for (sync_api::ChangeRecordList::const_iterator it = |
186 changes.Get().begin(); it != changes.Get().end(); ++it) { | 186 changes.Get().begin(); it != changes.Get().end(); ++it) { |
187 if (sync_api::ChangeRecord::ACTION_DELETE == | 187 if (sync_api::ChangeRecord::ACTION_DELETE == |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 void PasswordChangeProcessor::StopObserving() { | 268 void PasswordChangeProcessor::StopObserving() { |
269 DCHECK(expected_loop_ == MessageLoop::current()); | 269 DCHECK(expected_loop_ == MessageLoop::current()); |
270 notification_registrar_.Remove( | 270 notification_registrar_.Remove( |
271 this, | 271 this, |
272 chrome::NOTIFICATION_LOGINS_CHANGED, | 272 chrome::NOTIFICATION_LOGINS_CHANGED, |
273 content::Source<PasswordStore>(password_store_)); | 273 content::Source<PasswordStore>(password_store_)); |
274 } | 274 } |
275 | 275 |
276 } // namespace browser_sync | 276 } // namespace browser_sync |
OLD | NEW |