blob: 7ed0724daa4060afd2c0b0d66285c10db6ac97b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/autofill/core/browser/form_parsing/search_field.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_regex_constants.h"
#include "components/autofill/core/browser/form_parsing/autofill_scanner.h"
namespace autofill {
// static
std::unique_ptr<FormField> SearchField::Parse(AutofillScanner* scanner,
const LanguageCode& page_language,
LogManager* log_manager) {
AutofillField* field;
auto& patterns = PatternProvider::GetInstance().GetMatchPatterns(
SEARCH_TERM, page_language);
if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kSearchTermRe),
MATCH_DEFAULT | MATCH_SEARCH | MATCH_TEXT_AREA,
patterns, &field, {log_manager, "kSearchTermRe"})) {
return std::make_unique<SearchField>(field);
}
return nullptr;
}
SearchField::SearchField(const AutofillField* field) : field_(field) {}
void SearchField::AddClassifications(
FieldCandidatesMap* field_candidates) const {
AddClassification(field_, SEARCH_TERM, kBaseSearchParserScore,
field_candidates);
}
} // namespace autofill
|