| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browsing_data/core/counters/autofill_counter.h" | 5 #include "components/browsing_data/core/counters/autofill_counter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 [start](const std::unique_ptr<autofill::AutofillProfile>& address) { | 140 [start](const std::unique_ptr<autofill::AutofillProfile>& address) { |
| 141 return address->modification_date() >= start; | 141 return address->modification_date() >= start; |
| 142 }); | 142 }); |
| 143 addresses_query_ = 0; | 143 addresses_query_ = 0; |
| 144 | 144 |
| 145 } else { | 145 } else { |
| 146 NOTREACHED() << "No such query: " << handle; | 146 NOTREACHED() << "No such query: " << handle; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // If we still have pending queries, do not report data yet. | 149 // If we still have pending queries, do not report data yet. |
| 150 if (HasPendingQuery()) | 150 if (suggestions_query_ || credit_cards_query_ || addresses_query_) |
| 151 return; | 151 return; |
| 152 | 152 |
| 153 std::unique_ptr<Result> reported_result(new AutofillResult( | 153 std::unique_ptr<Result> reported_result(new AutofillResult( |
| 154 this, num_suggestions_, num_credit_cards_, num_addresses_)); | 154 this, num_suggestions_, num_credit_cards_, num_addresses_)); |
| 155 ReportResult(std::move(reported_result)); | 155 ReportResult(std::move(reported_result)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void AutofillCounter::CancelAllRequests() { | 158 void AutofillCounter::CancelAllRequests() { |
| 159 if (suggestions_query_) | 159 if (suggestions_query_) |
| 160 web_data_service_->CancelRequest(suggestions_query_); | 160 web_data_service_->CancelRequest(suggestions_query_); |
| 161 if (credit_cards_query_) | 161 if (credit_cards_query_) |
| 162 web_data_service_->CancelRequest(credit_cards_query_); | 162 web_data_service_->CancelRequest(credit_cards_query_); |
| 163 if (addresses_query_) | 163 if (addresses_query_) |
| 164 web_data_service_->CancelRequest(addresses_query_); | 164 web_data_service_->CancelRequest(addresses_query_); |
| 165 } | 165 } |
| 166 | 166 |
| 167 // AutofillCounter::AutofillResult --------------------------------------------- | 167 // AutofillCounter::AutofillResult --------------------------------------------- |
| 168 | 168 |
| 169 AutofillCounter::AutofillResult::AutofillResult(const AutofillCounter* source, | 169 AutofillCounter::AutofillResult::AutofillResult(const AutofillCounter* source, |
| 170 ResultInt num_suggestions, | 170 ResultInt num_suggestions, |
| 171 ResultInt num_credit_cards, | 171 ResultInt num_credit_cards, |
| 172 ResultInt num_addresses) | 172 ResultInt num_addresses) |
| 173 : FinishedResult(source, num_suggestions), | 173 : FinishedResult(source, num_suggestions), |
| 174 num_credit_cards_(num_credit_cards), | 174 num_credit_cards_(num_credit_cards), |
| 175 num_addresses_(num_addresses) {} | 175 num_addresses_(num_addresses) {} |
| 176 | 176 |
| 177 AutofillCounter::AutofillResult::~AutofillResult() {} | 177 AutofillCounter::AutofillResult::~AutofillResult() {} |
| 178 | 178 |
| 179 } // namespace browsing_data | 179 } // namespace browsing_data |
| OLD | NEW |