| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/password_syncable_service.h" | 5 #include "components/password_manager/core/browser/password_syncable_service.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ScopedVector<autofill::PasswordForm>* EntriesForChangeType( | 106 ScopedVector<autofill::PasswordForm>* EntriesForChangeType( |
| 107 syncer::SyncChange::SyncChangeType type) { | 107 syncer::SyncChange::SyncChangeType type) { |
| 108 switch (type) { | 108 switch (type) { |
| 109 case syncer::SyncChange::ACTION_ADD: | 109 case syncer::SyncChange::ACTION_ADD: |
| 110 return &new_entries; | 110 return &new_entries; |
| 111 case syncer::SyncChange::ACTION_UPDATE: | 111 case syncer::SyncChange::ACTION_UPDATE: |
| 112 return &updated_entries; | 112 return &updated_entries; |
| 113 case syncer::SyncChange::ACTION_DELETE: | 113 case syncer::SyncChange::ACTION_DELETE: |
| 114 return &deleted_entries; | 114 return &deleted_entries; |
| 115 case syncer::SyncChange::ACTION_INVALID: | 115 case syncer::SyncChange::ACTION_INVALID: |
| 116 return NULL; | 116 return nullptr; |
| 117 } | 117 } |
| 118 NOTREACHED(); | 118 NOTREACHED(); |
| 119 return NULL; | 119 return nullptr; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // List that contains the entries that are known only to sync. | 122 // List that contains the entries that are known only to sync. |
| 123 ScopedVector<autofill::PasswordForm> new_entries; | 123 ScopedVector<autofill::PasswordForm> new_entries; |
| 124 | 124 |
| 125 // List that contains the entries that are known to both sync and the local | 125 // List that contains the entries that are known to both sync and the local |
| 126 // database but have updates in sync. They need to be updated in the local | 126 // database but have updates in sync. They need to be updated in the local |
| 127 // database. | 127 // database. |
| 128 ScopedVector<autofill::PasswordForm> updated_entries; | 128 ScopedVector<autofill::PasswordForm> updated_entries; |
| 129 | 129 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 sync_processor_.reset(); | 224 sync_processor_.reset(); |
| 225 sync_error_factory_.reset(); | 225 sync_error_factory_.reset(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 syncer::SyncDataList PasswordSyncableService::GetAllSyncData( | 228 syncer::SyncDataList PasswordSyncableService::GetAllSyncData( |
| 229 syncer::ModelType type) const { | 229 syncer::ModelType type) const { |
| 230 DCHECK(CalledOnValidThread()); | 230 DCHECK(CalledOnValidThread()); |
| 231 DCHECK_EQ(syncer::PASSWORDS, type); | 231 DCHECK_EQ(syncer::PASSWORDS, type); |
| 232 ScopedVector<autofill::PasswordForm> password_entries; | 232 ScopedVector<autofill::PasswordForm> password_entries; |
| 233 ReadFromPasswordStore(&password_entries, NULL); | 233 ReadFromPasswordStore(&password_entries, nullptr); |
| 234 | 234 |
| 235 syncer::SyncDataList sync_data; | 235 syncer::SyncDataList sync_data; |
| 236 for (PasswordForms::iterator it = password_entries.begin(); | 236 for (PasswordForms::iterator it = password_entries.begin(); |
| 237 it != password_entries.end(); ++it) { | 237 it != password_entries.end(); ++it) { |
| 238 sync_data.push_back(SyncDataFromPassword(**it)); | 238 sync_data.push_back(SyncDataFromPassword(**it)); |
| 239 } | 239 } |
| 240 return sync_data; | 240 return sync_data; |
| 241 } | 241 } |
| 242 | 242 |
| 243 syncer::SyncError PasswordSyncableService::ProcessSyncChanges( | 243 syncer::SyncError PasswordSyncableService::ProcessSyncChanges( |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) { | 492 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) { |
| 493 return (net::EscapePath(password.origin.spec()) + "|" + | 493 return (net::EscapePath(password.origin.spec()) + "|" + |
| 494 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" + | 494 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" + |
| 495 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" + | 495 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" + |
| 496 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" + | 496 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" + |
| 497 net::EscapePath(password.signon_realm)); | 497 net::EscapePath(password.signon_realm)); |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace password_manager | 500 } // namespace password_manager |
| OLD | NEW |