| 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/password_manager/password_store.h" | 9 #include "chrome/browser/password_manager/password_store.h" |
| 10 #include "chrome/browser/password_manager/password_store_change.h" | 10 #include "chrome/browser/password_manager/password_store_change.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (!sync_node.InitByIdLookup(changes[i].id)) { | 146 if (!sync_node.InitByIdLookup(changes[i].id)) { |
| 147 error_handler()->OnUnrecoverableError(FROM_HERE, | 147 error_handler()->OnUnrecoverableError(FROM_HERE, |
| 148 "Password node lookup failed."); | 148 "Password node lookup failed."); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Check that the changed node is a child of the passwords folder. | 152 // Check that the changed node is a child of the passwords folder. |
| 153 DCHECK(password_root.GetId() == sync_node.GetParentId()); | 153 DCHECK(password_root.GetId() == sync_node.GetParentId()); |
| 154 DCHECK(syncable::PASSWORDS == sync_node.GetModelType()); | 154 DCHECK(syncable::PASSWORDS == sync_node.GetModelType()); |
| 155 | 155 |
| 156 sync_pb::PasswordSpecificsData password_data; | 156 const sync_pb::PasswordSpecificsData& password_data = |
| 157 if (!sync_node.GetPasswordSpecifics(&password_data)) { | 157 sync_node.GetPasswordSpecifics(); |
| 158 error_handler()->OnUnrecoverableError(FROM_HERE, | |
| 159 "Could not read password specifics"); | |
| 160 return; | |
| 161 } | |
| 162 webkit_glue::PasswordForm password; | 158 webkit_glue::PasswordForm password; |
| 163 PasswordModelAssociator::CopyPassword(password_data, | 159 PasswordModelAssociator::CopyPassword(password_data, |
| 164 &password); | 160 &password); |
| 165 | 161 |
| 166 if (sync_api::SyncManager::ChangeRecord::ACTION_ADD == changes[i].action) { | 162 if (sync_api::SyncManager::ChangeRecord::ACTION_ADD == changes[i].action) { |
| 167 new_passwords.push_back(password); | 163 new_passwords.push_back(password); |
| 168 } else if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == | 164 } else if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == |
| 169 changes[i].action) { | 165 changes[i].action) { |
| 170 deleted_passwords.push_back(password); | 166 deleted_passwords.push_back(password); |
| 171 } else { | 167 } else { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 199 } |
| 204 | 200 |
| 205 void PasswordChangeProcessor::StopObserving() { | 201 void PasswordChangeProcessor::StopObserving() { |
| 206 DCHECK(expected_loop_ == MessageLoop::current()); | 202 DCHECK(expected_loop_ == MessageLoop::current()); |
| 207 notification_registrar_.Remove(this, | 203 notification_registrar_.Remove(this, |
| 208 NotificationType::LOGINS_CHANGED, | 204 NotificationType::LOGINS_CHANGED, |
| 209 NotificationService::AllSources()); | 205 NotificationService::AllSources()); |
| 210 } | 206 } |
| 211 | 207 |
| 212 } // namespace browser_sync | 208 } // namespace browser_sync |
| OLD | NEW |