OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 PasswordModelAssociator::PasswordVector updated_passwords; | 143 PasswordModelAssociator::PasswordVector updated_passwords; |
144 PasswordModelAssociator::PasswordVector deleted_passwords; | 144 PasswordModelAssociator::PasswordVector deleted_passwords; |
145 | 145 |
146 for (int i = 0; i < change_count; ++i) { | 146 for (int i = 0; i < change_count; ++i) { |
147 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == | 147 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == |
148 changes[i].action) { | 148 changes[i].action) { |
149 DCHECK(changes[i].specifics.HasExtension(sync_pb::password)) | 149 DCHECK(changes[i].specifics.HasExtension(sync_pb::password)) |
150 << "Password specifics data not present on delete!"; | 150 << "Password specifics data not present on delete!"; |
151 DCHECK(changes[i].extra.get()); | 151 DCHECK(changes[i].extra.get()); |
152 sync_api::SyncManager::ExtraPasswordChangeRecordData* extra = | 152 sync_api::SyncManager::ExtraPasswordChangeRecordData* extra = |
153 changes[i].extra.get(); | 153 static_cast<sync_api::SyncManager::ExtraPasswordChangeRecordData*>( |
| 154 changes[i].extra.get()); |
154 const sync_pb::PasswordSpecificsData& password = extra->unencrypted(); | 155 const sync_pb::PasswordSpecificsData& password = extra->unencrypted(); |
155 webkit_glue::PasswordForm form; | 156 webkit_glue::PasswordForm form; |
156 PasswordModelAssociator::CopyPassword(password, &form); | 157 PasswordModelAssociator::CopyPassword(password, &form); |
157 deleted_passwords.push_back(form); | 158 deleted_passwords.push_back(form); |
158 model_associator_->Disassociate(changes[i].id); | 159 model_associator_->Disassociate(changes[i].id); |
159 continue; | 160 continue; |
160 } | 161 } |
161 | 162 |
162 sync_api::ReadNode sync_node(trans); | 163 sync_api::ReadNode sync_node(trans); |
163 if (!sync_node.InitByIdLookup(changes[i].id)) { | 164 if (!sync_node.InitByIdLookup(changes[i].id)) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 216 } |
216 | 217 |
217 void PasswordChangeProcessor::StopObserving() { | 218 void PasswordChangeProcessor::StopObserving() { |
218 DCHECK(expected_loop_ == MessageLoop::current()); | 219 DCHECK(expected_loop_ == MessageLoop::current()); |
219 notification_registrar_.Remove(this, | 220 notification_registrar_.Remove(this, |
220 NotificationType::LOGINS_CHANGED, | 221 NotificationType::LOGINS_CHANGED, |
221 Source<PasswordStore>(password_store_)); | 222 Source<PasswordStore>(password_store_)); |
222 } | 223 } |
223 | 224 |
224 } // namespace browser_sync | 225 } // namespace browser_sync |
OLD | NEW |