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

Unified Diff: components/autofill/core/browser/autofill_scanner.cc

Issue 2609703002: Remove ScopedVector from autofill. (Closed)
Patch Set: drop the using Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « components/autofill/core/browser/autofill_scanner.h ('k') | components/autofill/core/browser/credit_card_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698