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 static_cast<sync_api::SyncManager::ExtraPasswordChangeRecordData*>( | 153 changes[i].extra.get(); |
154 changes[i].extra.get()); | |
155 const sync_pb::PasswordSpecificsData& password = extra->unencrypted(); | 154 const sync_pb::PasswordSpecificsData& password = extra->unencrypted(); |
156 webkit_glue::PasswordForm form; | 155 webkit_glue::PasswordForm form; |
157 PasswordModelAssociator::CopyPassword(password, &form); | 156 PasswordModelAssociator::CopyPassword(password, &form); |
158 deleted_passwords.push_back(form); | 157 deleted_passwords.push_back(form); |
159 model_associator_->Disassociate(changes[i].id); | 158 model_associator_->Disassociate(changes[i].id); |
160 continue; | 159 continue; |
161 } | 160 } |
162 | 161 |
163 sync_api::ReadNode sync_node(trans); | 162 sync_api::ReadNode sync_node(trans); |
164 if (!sync_node.InitByIdLookup(changes[i].id)) { | 163 if (!sync_node.InitByIdLookup(changes[i].id)) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 215 } |
217 | 216 |
218 void PasswordChangeProcessor::StopObserving() { | 217 void PasswordChangeProcessor::StopObserving() { |
219 DCHECK(expected_loop_ == MessageLoop::current()); | 218 DCHECK(expected_loop_ == MessageLoop::current()); |
220 notification_registrar_.Remove(this, | 219 notification_registrar_.Remove(this, |
221 NotificationType::LOGINS_CHANGED, | 220 NotificationType::LOGINS_CHANGED, |
222 Source<PasswordStore>(password_store_)); | 221 Source<PasswordStore>(password_store_)); |
223 } | 222 } |
224 | 223 |
225 } // namespace browser_sync | 224 } // namespace browser_sync |
OLD | NEW |