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

Unified Diff: third_party/libaddressinput/chromium/cpp/src/address_data.cc

Issue 261013010: autocomplete: add ability to get full address (hidden behind a flag). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mo betta Created 6 years, 7 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/cpp/src/address_data.cc
diff --git a/third_party/libaddressinput/chromium/cpp/src/address_data.cc b/third_party/libaddressinput/chromium/cpp/src/address_data.cc
index 08da6ca153507e543ff5af83d100f3008bc052ee..bfd21e8ad6ab7f2a675c7def1aaf87fe00a6df5c 100644
--- a/third_party/libaddressinput/chromium/cpp/src/address_data.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/address_data.cc
@@ -50,10 +50,12 @@ const std::string* GetMemberForField(const AddressData& address,
return &address.organization;
case RECIPIENT:
return &address.recipient;
- default:
- assert(false);
- return NULL;
+ case STREET_ADDRESS:
+ break;
}
+
+ assert(false);
+ return NULL;
}
} // namespace
@@ -117,5 +119,26 @@ void AddressData::SetFieldValue(AddressField field, const std::string& value) {
}
}
+bool AddressData::HasAllRequiredFields() const {
+ if (country_code.empty())
+ return false;
+
+ Rule rule;
+ rule.CopyFrom(Rule::GetDefault());
+ if (!rule.ParseSerializedRule(
+ RegionDataConstants::GetRegionData(country_code))) {
+ return false;
+ }
+
+ std::vector<::i18n::addressinput::AddressField> required_fields =
please use gerrit instead 2014/05/09 22:26:50 Place add a space between < and ::.
Evan Stade 2014/05/09 22:49:08 Done.
+ rule.GetRequired();
+ for (size_t i = 0; i < required_fields.size(); ++i) {
+ if (GetFieldValue(required_fields[i]).empty())
please use gerrit instead 2014/05/09 22:26:50 Please check for STREET_ADDRESS here to avoid the
Evan Stade 2014/05/09 22:49:08 Done.
+ return false;
+ }
+
+ return true;
+}
+
} // namespace addressinput
} // namespace i18n

Powered by Google App Engine
This is Rietveld 408576698