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

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

Issue 2760653002: Add FormFetcher::RemoveConsumer (Closed)
Patch Set: Rebased Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/form_fetcher_impl.h" 5 #include "components/password_manager/core/browser/form_fetcher_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 FormFetcherImpl::~FormFetcherImpl() = default; 81 FormFetcherImpl::~FormFetcherImpl() = default;
82 82
83 void FormFetcherImpl::AddConsumer(FormFetcher::Consumer* consumer) { 83 void FormFetcherImpl::AddConsumer(FormFetcher::Consumer* consumer) {
84 DCHECK(consumer); 84 DCHECK(consumer);
85 consumers_.insert(consumer); 85 consumers_.insert(consumer);
86 if (state_ == State::NOT_WAITING) 86 if (state_ == State::NOT_WAITING)
87 consumer->ProcessMatches(weak_non_federated_, filtered_count_); 87 consumer->ProcessMatches(weak_non_federated_, filtered_count_);
88 } 88 }
89 89
90 void FormFetcherImpl::RemoveConsumer(FormFetcher::Consumer* consumer) {
91 size_t removed_consumers = consumers_.erase(consumer);
92 DCHECK_EQ(1u, removed_consumers);
93 }
94
90 FormFetcherImpl::State FormFetcherImpl::GetState() const { 95 FormFetcherImpl::State FormFetcherImpl::GetState() const {
91 return state_; 96 return state_;
92 } 97 }
93 98
94 const std::vector<InteractionsStats>& FormFetcherImpl::GetInteractionsStats() 99 const std::vector<InteractionsStats>& FormFetcherImpl::GetInteractionsStats()
95 const { 100 const {
96 return interactions_stats_; 101 return interactions_stats_;
97 } 102 }
98 103
99 const std::vector<const PasswordForm*>& FormFetcherImpl::GetFederatedMatches() 104 const std::vector<const PasswordForm*>& FormFetcherImpl::GetFederatedMatches()
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 filtered_count_ = original_count - non_federated_.size(); 220 filtered_count_ = original_count - non_federated_.size();
216 221
217 weak_non_federated_ = MakeWeakCopies(non_federated_); 222 weak_non_federated_ = MakeWeakCopies(non_federated_);
218 weak_federated_ = MakeWeakCopies(federated_); 223 weak_federated_ = MakeWeakCopies(federated_);
219 224
220 for (FormFetcher::Consumer* consumer : consumers_) 225 for (FormFetcher::Consumer* consumer : consumers_)
221 consumer->ProcessMatches(weak_non_federated_, filtered_count_); 226 consumer->ProcessMatches(weak_non_federated_, filtered_count_);
222 } 227 }
223 228
224 } // namespace password_manager 229 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698