Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: components/password_manager/core/browser/password_syncable_service.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 bool PasswordSyncableService::ReadFromPasswordStore( 294 bool PasswordSyncableService::ReadFromPasswordStore(
295 std::vector<std::unique_ptr<autofill::PasswordForm>>* password_entries, 295 std::vector<std::unique_ptr<autofill::PasswordForm>>* password_entries,
296 PasswordEntryMap* passwords_entry_map) const { 296 PasswordEntryMap* passwords_entry_map) const {
297 DCHECK(password_entries); 297 DCHECK(password_entries);
298 std::vector<std::unique_ptr<autofill::PasswordForm>> autofillable_entries; 298 std::vector<std::unique_ptr<autofill::PasswordForm>> autofillable_entries;
299 std::vector<std::unique_ptr<autofill::PasswordForm>> blacklist_entries; 299 std::vector<std::unique_ptr<autofill::PasswordForm>> blacklist_entries;
300 if (!password_store_->FillAutofillableLogins(&autofillable_entries) || 300 if (!password_store_->FillAutofillableLogins(&autofillable_entries) ||
301 !password_store_->FillBlacklistLogins(&blacklist_entries)) { 301 !password_store_->FillBlacklistLogins(&blacklist_entries)) {
302 // Password store often fails to load passwords. Track failures with UMA. 302 // Password store often fails to load passwords. Track failures with UMA.
303 // (http://crbug.com/249000) 303 // (http://crbug.com/249000)
304 // TODO(wychen): enum uma should be strongly typed. crbug.com/661401
304 UMA_HISTOGRAM_ENUMERATION("Sync.LocalDataFailedToLoad", 305 UMA_HISTOGRAM_ENUMERATION("Sync.LocalDataFailedToLoad",
305 ModelTypeToHistogramInt(syncer::PASSWORDS), 306 ModelTypeToHistogramInt(syncer::PASSWORDS),
306 syncer::MODEL_TYPE_COUNT); 307 static_cast<int>(syncer::MODEL_TYPE_COUNT));
307 return false; 308 return false;
308 } 309 }
309 password_entries->resize(autofillable_entries.size() + 310 password_entries->resize(autofillable_entries.size() +
310 blacklist_entries.size()); 311 blacklist_entries.size());
311 std::move(autofillable_entries.begin(), autofillable_entries.end(), 312 std::move(autofillable_entries.begin(), autofillable_entries.end(),
312 password_entries->begin()); 313 password_entries->begin());
313 std::move(blacklist_entries.begin(), blacklist_entries.end(), 314 std::move(blacklist_entries.begin(), blacklist_entries.end(),
314 password_entries->begin() + autofillable_entries.size()); 315 password_entries->begin() + autofillable_entries.size());
315 316
316 if (!passwords_entry_map) 317 if (!passwords_entry_map)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 466
466 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) { 467 std::string MakePasswordSyncTag(const autofill::PasswordForm& password) {
467 return (net::EscapePath(password.origin.spec()) + "|" + 468 return (net::EscapePath(password.origin.spec()) + "|" +
468 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" + 469 net::EscapePath(base::UTF16ToUTF8(password.username_element)) + "|" +
469 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" + 470 net::EscapePath(base::UTF16ToUTF8(password.username_value)) + "|" +
470 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" + 471 net::EscapePath(base::UTF16ToUTF8(password.password_element)) + "|" +
471 net::EscapePath(password.signon_realm)); 472 net::EscapePath(password.signon_realm));
472 } 473 }
473 474
474 } // namespace password_manager 475 } // namespace password_manager
OLDNEW
« no previous file with comments | « components/metrics/stability_metrics_helper.cc ('k') | components/payments/core/journey_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698