| 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 <utility> |
| 8 |
| 7 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 8 #include "base/location.h" | 10 #include "base/location.h" |
| 9 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 10 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/autofill/core/common/password_form.h" | 14 #include "components/autofill/core/common/password_form.h" |
| 13 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 15 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 14 #include "components/password_manager/core/browser/password_store_sync.h" | 16 #include "components/password_manager/core/browser/password_store_sync.h" |
| 15 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 16 #include "sync/api/sync_error_factory.h" | 18 #include "sync/api/sync_error_factory.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 213 |
| 212 merge_result.set_num_items_after_association( | 214 merge_result.set_num_items_after_association( |
| 213 merge_result.num_items_before_association() + | 215 merge_result.num_items_before_association() + |
| 214 sync_entries.new_entries.size()); | 216 sync_entries.new_entries.size()); |
| 215 merge_result.set_num_items_added(sync_entries.new_entries.size()); | 217 merge_result.set_num_items_added(sync_entries.new_entries.size()); |
| 216 merge_result.set_num_items_modified(sync_entries.updated_entries.size()); | 218 merge_result.set_num_items_modified(sync_entries.updated_entries.size()); |
| 217 merge_result.set_num_items_deleted(sync_entries.deleted_entries.size()); | 219 merge_result.set_num_items_deleted(sync_entries.deleted_entries.size()); |
| 218 | 220 |
| 219 // Save |sync_processor_| only if the whole procedure succeeded. In case of | 221 // Save |sync_processor_| only if the whole procedure succeeded. In case of |
| 220 // failure Sync shouldn't receive any updates from the PasswordStore. | 222 // failure Sync shouldn't receive any updates from the PasswordStore. |
| 221 sync_error_factory_ = sync_error_factory.Pass(); | 223 sync_error_factory_ = std::move(sync_error_factory); |
| 222 sync_processor_ = sync_processor.Pass(); | 224 sync_processor_ = std::move(sync_processor); |
| 223 | 225 |
| 224 metrics_util::LogPasswordSyncState(metrics_util::SYNCING_OK); | 226 metrics_util::LogPasswordSyncState(metrics_util::SYNCING_OK); |
| 225 return merge_result; | 227 return merge_result; |
| 226 } | 228 } |
| 227 | 229 |
| 228 void PasswordSyncableService::StopSyncing(syncer::ModelType type) { | 230 void PasswordSyncableService::StopSyncing(syncer::ModelType type) { |
| 229 DCHECK(CalledOnValidThread()); | 231 DCHECK(CalledOnValidThread()); |
| 230 DCHECK_EQ(syncer::PASSWORDS, type); | 232 DCHECK_EQ(syncer::PASSWORDS, type); |
| 231 | 233 |
| 232 sync_processor_.reset(); | 234 sync_processor_.reset(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 506 |
| 505 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) { | 507 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) { |
| 506 return (net::EscapePath(password.origin.spec()) + "|" + | 508 return (net::EscapePath(password.origin.spec()) + "|" + |
| 507 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" + | 509 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" + |
| 508 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" + | 510 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" + |
| 509 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" + | 511 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" + |
| 510 net::EscapePath(password.signon_realm)); | 512 net::EscapePath(password.signon_realm)); |
| 511 } | 513 } |
| 512 | 514 |
| 513 } // namespace password_manager | 515 } // namespace password_manager |
| OLD | NEW |