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

Unified Diff: third_party/libaddressinput/chromium/addressinput_util.cc

Issue 389733002: Reland "Use upstream libaddressinput in Chrome." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix GN build. Created 6 years, 5 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: third_party/libaddressinput/chromium/addressinput_util.cc
diff --git a/third_party/libaddressinput/chromium/addressinput_util.cc b/third_party/libaddressinput/chromium/addressinput_util.cc
index 3af6137de46c2334f9550813b2e32eb996c3a3b4..d9e6725b06803daa8b4bc7f031dd999cb18efa5f 100644
--- a/third_party/libaddressinput/chromium/addressinput_util.cc
+++ b/third_party/libaddressinput/chromium/addressinput_util.cc
@@ -8,8 +8,8 @@
#include "base/logging.h"
#include "base/macros.h"
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_data.h"
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_metadata.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_metadata.h"
namespace autofill {
namespace addressinput {
@@ -21,32 +21,32 @@ using ::i18n::addressinput::AddressField;
using ::i18n::addressinput::AddressProblem;
using ::i18n::addressinput::IsFieldRequired;
+using ::i18n::addressinput::MISSING_REQUIRED_FIELD;
+
// Returns true if the |problem| should not be reported for the |field| because
// the |filter| excludes it.
-bool FilterExcludes(
- const std::multimap<AddressField, AddressProblem::Type>* filter,
- AddressField field,
- AddressProblem::Type problem) {
+bool FilterExcludes(const std::multimap<AddressField, AddressProblem>* filter,
+ AddressField field,
+ AddressProblem problem) {
return filter != NULL && !filter->empty() &&
- std::find(
- filter->begin(),
- filter->end(),
- std::multimap<AddressField, AddressProblem::Type>::value_type(
- field, problem)) == filter->end();
+ std::find(filter->begin(),
+ filter->end(),
+ std::multimap<AddressField, AddressProblem>::value_type(
+ field, problem)) == filter->end();
}
} // namespace
bool HasAllRequiredFields(const AddressData& address_to_check) {
- std::multimap<AddressField, AddressProblem::Type> problems;
+ std::multimap<AddressField, AddressProblem> problems;
ValidateRequiredFields(address_to_check, NULL, &problems);
return problems.empty();
}
void ValidateRequiredFields(
const AddressData& address_to_check,
- const std::multimap<AddressField, AddressProblem::Type>* filter,
- std::multimap<AddressField, AddressProblem::Type>* problems) {
+ const std::multimap<AddressField, AddressProblem>* filter,
+ std::multimap<AddressField, AddressProblem>* problems) {
DCHECK(problems);
static const AddressField kFields[] = {
@@ -63,10 +63,8 @@ void ValidateRequiredFields(
AddressField field = kFields[i];
if (address_to_check.IsFieldEmpty(field) &&
IsFieldRequired(field, address_to_check.region_code) &&
- !FilterExcludes(
- filter, field, AddressProblem::MISSING_REQUIRED_FIELD)) {
- problems->insert(
- std::make_pair(field, AddressProblem::MISSING_REQUIRED_FIELD));
+ !FilterExcludes(filter, field, MISSING_REQUIRED_FIELD)) {
+ problems->insert(std::make_pair(field, MISSING_REQUIRED_FIELD));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698