| Index: components/password_manager/core/browser/password_store.cc
|
| diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc
|
| index 395abb950d49a63dda6f631356c1d58d637154a3..bb424b2930569ef90f155f3f763ed298b298a247 100644
|
| --- a/components/password_manager/core/browser/password_store.cc
|
| +++ b/components/password_manager/core/browser/password_store.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/debug/dump_without_crashing.h"
|
| #include "base/location.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/stl_util.h"
|
| #include "base/thread_task_runner_handle.h"
|
| @@ -65,9 +66,9 @@ void PasswordStore::GetLoginsRequest::NotifyConsumerWithResults(
|
| }
|
|
|
| void PasswordStore::GetLoginsRequest::NotifyWithSiteStatistics(
|
| - std::vector<scoped_ptr<InteractionsStats>> stats) {
|
| - auto passed_stats(make_scoped_ptr(
|
| - new std::vector<scoped_ptr<InteractionsStats>>(std::move(stats))));
|
| + std::vector<std::unique_ptr<InteractionsStats>> stats) {
|
| + auto passed_stats(base::WrapUnique(
|
| + new std::vector<std::unique_ptr<InteractionsStats>>(std::move(stats))));
|
| origin_task_runner_->PostTask(
|
| FROM_HERE, base::Bind(&PasswordStoreConsumer::OnGetSiteStatistics,
|
| consumer_weak_, base::Passed(&passed_stats)));
|
| @@ -89,7 +90,7 @@ bool PasswordStore::Init(const syncer::SyncableService::StartSyncFlare& flare) {
|
| }
|
|
|
| void PasswordStore::SetAffiliatedMatchHelper(
|
| - scoped_ptr<AffiliatedMatchHelper> helper) {
|
| + std::unique_ptr<AffiliatedMatchHelper> helper) {
|
| affiliated_match_helper_ = std::move(helper);
|
| }
|
|
|
| @@ -178,7 +179,7 @@ void PasswordStore::GetLogins(const PasswordForm& form,
|
| { 2012, 1, 0, 1, 0, 0, 0, 0 }; // 00:00 Jan 1 2012
|
| ignore_logins_cutoff = base::Time::FromUTCExploded(exploded_cutoff);
|
| }
|
| - scoped_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| + std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| request->set_ignore_logins_cutoff(ignore_logins_cutoff);
|
|
|
| if (affiliated_match_helper_) {
|
| @@ -235,7 +236,7 @@ void PasswordStore::RemoveSiteStats(const GURL& origin_domain) {
|
|
|
| void PasswordStore::GetSiteStats(const GURL& origin_domain,
|
| PasswordStoreConsumer* consumer) {
|
| - scoped_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| + std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| ScheduleTask(base::Bind(&PasswordStore::NotifySiteStats, this, origin_domain,
|
| base::Passed(&request)));
|
| }
|
| @@ -280,7 +281,7 @@ PasswordStore::GetBackgroundTaskRunner() {
|
| }
|
|
|
| void PasswordStore::GetLoginsImpl(const autofill::PasswordForm& form,
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| request->NotifyConsumerWithResults(FillMatchingLogins(form));
|
| }
|
|
|
| @@ -313,7 +314,7 @@ PasswordStoreChangeList PasswordStore::UpdateLoginSync(
|
| // password were to be propagated to affiliated credentials in that case, it
|
| // may very well overwrite the actual, up-to-date password. Try to mitigate
|
| // this risk by ignoring updates unless they actually update the password.
|
| - scoped_ptr<PasswordForm> old_form(GetLoginImpl(form));
|
| + std::unique_ptr<PasswordForm> old_form(GetLoginImpl(form));
|
| if (old_form && form.password_value != old_form->password_value)
|
| ScheduleFindAndUpdateAffiliatedWebLogins(form);
|
| }
|
| @@ -336,9 +337,9 @@ void PasswordStore::NotifyLoginsChanged(
|
| }
|
|
|
| void PasswordStore::Schedule(
|
| - void (PasswordStore::*func)(scoped_ptr<GetLoginsRequest>),
|
| + void (PasswordStore::*func)(std::unique_ptr<GetLoginsRequest>),
|
| PasswordStoreConsumer* consumer) {
|
| - scoped_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| + std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
|
| consumer->cancelable_task_tracker()->PostTask(
|
| GetBackgroundTaskRunner().get(), FROM_HERE,
|
| base::Bind(func, this, base::Passed(&request)));
|
| @@ -420,7 +421,7 @@ void PasswordStore::DisableAutoSignInForAllLoginsInternal(
|
| }
|
|
|
| void PasswordStore::GetAutofillableLoginsImpl(
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| ScopedVector<PasswordForm> obtained_forms;
|
| if (!FillAutofillableLogins(&obtained_forms))
|
| obtained_forms.clear();
|
| @@ -428,7 +429,7 @@ void PasswordStore::GetAutofillableLoginsImpl(
|
| }
|
|
|
| void PasswordStore::GetAutofillableLoginsWithAffiliatedRealmsImpl(
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| ScopedVector<PasswordForm> obtained_forms;
|
| if (!FillAutofillableLogins(&obtained_forms))
|
| obtained_forms.clear();
|
| @@ -441,13 +442,13 @@ void PasswordStore::GetAutofillableLoginsWithAffiliatedRealmsImpl(
|
| }
|
|
|
| void PasswordStore::NotifyLoginsWithAffiliatedRealms(
|
| - scoped_ptr<GetLoginsRequest> request,
|
| + std::unique_ptr<GetLoginsRequest> request,
|
| ScopedVector<PasswordForm> obtained_forms) {
|
| request->NotifyConsumerWithResults(std::move(obtained_forms));
|
| }
|
|
|
| void PasswordStore::GetBlacklistLoginsImpl(
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| ScopedVector<PasswordForm> obtained_forms;
|
| if (!FillBlacklistLogins(&obtained_forms))
|
| obtained_forms.clear();
|
| @@ -455,7 +456,7 @@ void PasswordStore::GetBlacklistLoginsImpl(
|
| }
|
|
|
| void PasswordStore::GetBlacklistLoginsWithAffiliatedRealmsImpl(
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| ScopedVector<PasswordForm> obtained_forms;
|
| if (!FillBlacklistLogins(&obtained_forms))
|
| obtained_forms.clear();
|
| @@ -468,13 +469,13 @@ void PasswordStore::GetBlacklistLoginsWithAffiliatedRealmsImpl(
|
| }
|
|
|
| void PasswordStore::NotifySiteStats(const GURL& origin_domain,
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| request->NotifyWithSiteStatistics(GetSiteStatsImpl(origin_domain));
|
| }
|
|
|
| void PasswordStore::GetLoginsWithAffiliationsImpl(
|
| const PasswordForm& form,
|
| - scoped_ptr<GetLoginsRequest> request,
|
| + std::unique_ptr<GetLoginsRequest> request,
|
| const std::vector<std::string>& additional_android_realms) {
|
| DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
|
| ScopedVector<PasswordForm> results(FillMatchingLogins(form));
|
| @@ -498,7 +499,7 @@ void PasswordStore::GetLoginsWithAffiliationsImpl(
|
|
|
| void PasswordStore::InjectAffiliatedWebRealms(
|
| ScopedVector<PasswordForm> forms,
|
| - scoped_ptr<GetLoginsRequest> request) {
|
| + std::unique_ptr<GetLoginsRequest> request) {
|
| if (affiliated_match_helper_) {
|
| affiliated_match_helper_->InjectAffiliatedWebRealms(
|
| std::move(forms),
|
| @@ -511,26 +512,26 @@ void PasswordStore::InjectAffiliatedWebRealms(
|
|
|
| void PasswordStore::ScheduleGetLoginsWithAffiliations(
|
| const PasswordForm& form,
|
| - scoped_ptr<GetLoginsRequest> request,
|
| + std::unique_ptr<GetLoginsRequest> request,
|
| const std::vector<std::string>& additional_android_realms) {
|
| ScheduleTask(base::Bind(&PasswordStore::GetLoginsWithAffiliationsImpl, this,
|
| form, base::Passed(&request),
|
| additional_android_realms));
|
| }
|
|
|
| -scoped_ptr<PasswordForm> PasswordStore::GetLoginImpl(
|
| +std::unique_ptr<PasswordForm> PasswordStore::GetLoginImpl(
|
| const PasswordForm& primary_key) {
|
| DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
|
| ScopedVector<PasswordForm> candidates(FillMatchingLogins(primary_key));
|
| for (PasswordForm*& candidate : candidates) {
|
| if (ArePasswordFormUniqueKeyEqual(*candidate, primary_key) &&
|
| !candidate->is_public_suffix_match) {
|
| - scoped_ptr<PasswordForm> result(candidate);
|
| + std::unique_ptr<PasswordForm> result(candidate);
|
| candidate = nullptr;
|
| return result;
|
| }
|
| }
|
| - return make_scoped_ptr<PasswordForm>(nullptr);
|
| + return base::WrapUnique<PasswordForm>(nullptr);
|
| }
|
|
|
| void PasswordStore::FindAndUpdateAffiliatedWebLogins(
|
|
|