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

Side by Side Diff: chrome/browser/password_manager/native_backend_kwallet_x.cc

Issue 2169263002: chrome/browser/password_manager: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/password_manager/native_backend_kwallet_x.h" 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 int wallet_handle = WalletHandle(); 471 int wallet_handle = WalletHandle();
472 if (wallet_handle == kInvalidKWalletHandle) 472 if (wallet_handle == kInvalidKWalletHandle)
473 return false; 473 return false;
474 474
475 ScopedVector<autofill::PasswordForm> all_forms; 475 ScopedVector<autofill::PasswordForm> all_forms;
476 if (!GetLoginsList(form.signon_realm, wallet_handle, &all_forms)) 476 if (!GetLoginsList(form.signon_realm, wallet_handle, &all_forms))
477 return false; 477 return false;
478 478
479 ScopedVector<autofill::PasswordForm> kept_forms; 479 ScopedVector<autofill::PasswordForm> kept_forms;
480 kept_forms.reserve(all_forms.size()); 480 kept_forms.reserve(all_forms.size());
481 for (auto& saved_form : all_forms) { 481 for (auto*& saved_form : all_forms) {
482 if (!ArePasswordFormUniqueKeyEqual(form, *saved_form)) { 482 if (!ArePasswordFormUniqueKeyEqual(form, *saved_form)) {
483 kept_forms.push_back(saved_form); 483 kept_forms.push_back(saved_form);
484 saved_form = nullptr; 484 saved_form = nullptr;
485 } 485 }
486 } 486 }
487 487
488 if (kept_forms.size() != all_forms.size()) { 488 if (kept_forms.size() != all_forms.size()) {
489 changes->push_back(password_manager::PasswordStoreChange( 489 changes->push_back(password_manager::PasswordStoreChange(
490 password_manager::PasswordStoreChange::REMOVE, form)); 490 password_manager::PasswordStoreChange::REMOVE, form));
491 return SetLoginsList(kept_forms.get(), form.signon_realm, wallet_handle); 491 return SetLoginsList(kept_forms.get(), form.signon_realm, wallet_handle);
(...skipping 17 matching lines...) Expand all
509 return RemoveLoginsBetween(delete_begin, delete_end, SYNC_TIMESTAMP, changes); 509 return RemoveLoginsBetween(delete_begin, delete_end, SYNC_TIMESTAMP, changes);
510 } 510 }
511 511
512 bool NativeBackendKWallet::DisableAutoSignInForOrigins( 512 bool NativeBackendKWallet::DisableAutoSignInForOrigins(
513 const base::Callback<bool(const GURL&)>& origin_filter, 513 const base::Callback<bool(const GURL&)>& origin_filter,
514 password_manager::PasswordStoreChangeList* changes) { 514 password_manager::PasswordStoreChangeList* changes) {
515 ScopedVector<autofill::PasswordForm> all_forms; 515 ScopedVector<autofill::PasswordForm> all_forms;
516 if (!GetAllLogins(&all_forms)) 516 if (!GetAllLogins(&all_forms))
517 return false; 517 return false;
518 518
519 for (auto& form : all_forms) { 519 for (auto* form : all_forms) {
520 if (origin_filter.Run(form->origin) && !form->skip_zero_click) { 520 if (origin_filter.Run(form->origin) && !form->skip_zero_click) {
521 form->skip_zero_click = true; 521 form->skip_zero_click = true;
522 if (!UpdateLogin(*form, changes)) 522 if (!UpdateLogin(*form, changes))
523 return false; 523 return false;
524 } 524 }
525 } 525 }
526 return true; 526 return true;
527 } 527 }
528 528
529 bool NativeBackendKWallet::GetLogins( 529 bool NativeBackendKWallet::GetLogins(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 623 }
624 624
625 // Update the backend. 625 // Update the backend.
626 for (const auto& forms : update_forms) { 626 for (const auto& forms : update_forms) {
627 if (!SetLoginsList(forms.second, forms.first, wallet_handle)) 627 if (!SetLoginsList(forms.second, forms.first, wallet_handle))
628 return false; 628 return false;
629 } 629 }
630 } 630 }
631 // We have to read all the entries, and then filter them here. 631 // We have to read all the entries, and then filter them here.
632 forms->reserve(all_forms.size()); 632 forms->reserve(all_forms.size());
633 for (auto& saved_form : all_forms) { 633 for (auto*& saved_form : all_forms) {
634 if (saved_form->blacklisted_by_user == 634 if (saved_form->blacklisted_by_user ==
635 (options == BlacklistOptions::BLACKLISTED)) { 635 (options == BlacklistOptions::BLACKLISTED)) {
636 forms->push_back(saved_form); 636 forms->push_back(saved_form);
637 saved_form = nullptr; 637 saved_form = nullptr;
638 } 638 }
639 } 639 }
640 640
641 return true; 641 return true;
642 } 642 }
643 643
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 bytes.size()); 735 bytes.size());
736 ScopedVector<autofill::PasswordForm> all_forms = 736 ScopedVector<autofill::PasswordForm> all_forms =
737 DeserializeValue(signon_realm, pickle); 737 DeserializeValue(signon_realm, pickle);
738 738
739 ScopedVector<autofill::PasswordForm> kept_forms; 739 ScopedVector<autofill::PasswordForm> kept_forms;
740 kept_forms.reserve(all_forms.size()); 740 kept_forms.reserve(all_forms.size());
741 base::Time autofill::PasswordForm::*date_member = 741 base::Time autofill::PasswordForm::*date_member =
742 date_to_compare == CREATION_TIMESTAMP 742 date_to_compare == CREATION_TIMESTAMP
743 ? &autofill::PasswordForm::date_created 743 ? &autofill::PasswordForm::date_created
744 : &autofill::PasswordForm::date_synced; 744 : &autofill::PasswordForm::date_synced;
745 for (auto& saved_form : all_forms) { 745 for (auto*& saved_form : all_forms) {
746 if (delete_begin <= saved_form->*date_member && 746 if (delete_begin <= saved_form->*date_member &&
747 (delete_end.is_null() || saved_form->*date_member < delete_end)) { 747 (delete_end.is_null() || saved_form->*date_member < delete_end)) {
748 changes->push_back(password_manager::PasswordStoreChange( 748 changes->push_back(password_manager::PasswordStoreChange(
749 password_manager::PasswordStoreChange::REMOVE, *saved_form)); 749 password_manager::PasswordStoreChange::REMOVE, *saved_form));
750 } else { 750 } else {
751 kept_forms.push_back(saved_form); 751 kept_forms.push_back(saved_form);
752 saved_form = nullptr; 752 saved_form = nullptr;
753 } 753 }
754 } 754 }
755 755
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 834 }
835 835
836 return handle; 836 return handle;
837 } 837 }
838 838
839 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { 839 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const {
840 // Originally, the folder name was always just "Chrome Form Data". 840 // Originally, the folder name was always just "Chrome Form Data".
841 // Now we use it to distinguish passwords for different profiles. 841 // Now we use it to distinguish passwords for different profiles.
842 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); 842 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_);
843 } 843 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | chrome/browser/password_manager/native_backend_libsecret.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698