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

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

Issue 109323011: [rac] Download all rules for a country code in libaddressinput. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address data Created 6 years, 11 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/rule.cc
diff --git a/third_party/libaddressinput/chromium/cpp/src/rule.cc b/third_party/libaddressinput/chromium/cpp/src/rule.cc
index 1566f646d15366e093d3a438551f172406edf109..43d5c4301fcdd40beac00a152105acb0e2004110 100644
--- a/third_party/libaddressinput/chromium/cpp/src/rule.cc
+++ b/third_party/libaddressinput/chromium/cpp/src/rule.cc
@@ -24,6 +24,7 @@
#include "grit.h"
#include "messages.h"
+#include "region_data_constants.h"
#include "util/json.h"
#include "util/string_split.h"
@@ -171,6 +172,18 @@ Rule::Rule()
Rule::~Rule() {}
+// static
+const Rule& Rule::GetDefault() {
+ // Allocated once and leaked on shutdown.
+ static Rule* default_rule = NULL;
+ if (default_rule == NULL) {
+ default_rule = new Rule;
+ default_rule->ParseSerializedRule(
+ RegionDataConstants::GetDefaultRegionData());
+ }
+ return *default_rule;
+}
+
void Rule::CopyFrom(const Rule& rule) {
format_ = rule.format_;
required_ = rule.required_;

Powered by Google App Engine
This is Rietveld 408576698