| Index: components/autofill/core/browser/autofill_scanner.cc
|
| diff --git a/components/autofill/core/browser/autofill_scanner.cc b/components/autofill/core/browser/autofill_scanner.cc
|
| index 47a8c4c989e52455310c399b558e2df51598e3aa..857a7b8987fb87c41fab1471e9de0a52708406bb 100644
|
| --- a/components/autofill/core/browser/autofill_scanner.cc
|
| +++ b/components/autofill/core/browser/autofill_scanner.cc
|
| @@ -9,11 +9,16 @@
|
|
|
| namespace autofill {
|
|
|
| -AutofillScanner::AutofillScanner(const std::vector<AutofillField*>& fields)
|
| - : cursor_(fields.begin()),
|
| - saved_cursor_(fields.begin()),
|
| - begin_(fields.begin()),
|
| - end_(fields.end()) {
|
| +AutofillScanner::AutofillScanner(const std::vector<AutofillField*>& fields) {
|
| + Init(fields);
|
| +}
|
| +
|
| +AutofillScanner::AutofillScanner(
|
| + const std::vector<std::unique_ptr<AutofillField>>& fields) {
|
| + for (const auto& field : fields)
|
| + non_owning_.push_back(field.get());
|
| +
|
| + Init(non_owning_);
|
| }
|
|
|
| AutofillScanner::~AutofillScanner() {
|
| @@ -27,7 +32,7 @@ void AutofillScanner::Advance() {
|
| AutofillField* AutofillScanner::Cursor() const {
|
| if (IsEnd()) {
|
| NOTREACHED();
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| return *cursor_;
|
| @@ -54,4 +59,11 @@ size_t AutofillScanner::SaveCursor() {
|
| return static_cast<size_t>(cursor_ - begin_);
|
| }
|
|
|
| +void AutofillScanner::Init(const std::vector<AutofillField*>& fields) {
|
| + cursor_ = fields.begin();
|
| + saved_cursor_ = fields.begin();
|
| + begin_ = fields.begin();
|
| + end_ = fields.end();
|
| +}
|
| +
|
| } // namespace autofill
|
|
|