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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/country_rules_aggregator.cc

Issue 116363003: [rac] Validate an address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Constify and remove .get() 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (C) 2014 Google Inc. 1 // Copyright (C) 2014 Google Inc.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 assert(request.parent != NULL); 136 assert(request.parent != NULL);
137 request.parent->AddLanguageCodeRule(request.id, rule.Pass()); 137 request.parent->AddLanguageCodeRule(request.id, rule.Pass());
138 ruleset = request.parent; 138 ruleset = request.parent;
139 } else if (request.level == COUNTRY) { 139 } else if (request.level == COUNTRY) {
140 // The default language and all supported languages for the country code are 140 // The default language and all supported languages for the country code are
141 // in the country-level rule without a language code identifier. For 141 // in the country-level rule without a language code identifier. For
142 // example: "data/CA". 142 // example: "data/CA".
143 default_language_ = rule->GetLanguage(); 143 default_language_ = rule->GetLanguage();
144 languages_ = rule->GetLanguages(); 144 languages_ = rule->GetLanguages();
145 145
146 root_.reset(new Ruleset(rule.Pass())); 146 root_.reset(new Ruleset(request.level, rule.Pass()));
147 ruleset = root_.get(); 147 ruleset = root_.get();
148 } else { 148 } else {
149 assert(request.parent != NULL); 149 assert(request.parent != NULL);
150 ruleset = new Ruleset(rule.Pass()); 150 ruleset = new Ruleset(request.level, rule.Pass());
151 request.parent->AddSubRegionRuleset( 151 request.parent->AddSubRegionRuleset(
152 request.id, scoped_ptr<Ruleset>(ruleset)); 152 request.id, scoped_ptr<Ruleset>(ruleset));
153 } 153 }
154 154
155 if (!request.is_language_code) { 155 if (!request.is_language_code) {
156 // Retrieve the language-specific rules for this region. 156 // Retrieve the language-specific rules for this region.
157 for (std::vector<std::string>::const_iterator 157 for (std::vector<std::string>::const_iterator
158 lang_it = languages_.begin(); 158 lang_it = languages_.begin();
159 lang_it != languages_.end(); 159 lang_it != languages_.end();
160 ++lang_it) { 160 ++lang_it) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 requests_.clear(); 201 requests_.clear();
202 country_code_.clear(); 202 country_code_.clear();
203 rules_ready_.reset(); 203 rules_ready_.reset();
204 root_.reset(); 204 root_.reset();
205 default_language_.clear(); 205 default_language_.clear();
206 languages_.clear(); 206 languages_.clear();
207 } 207 }
208 208
209 } // namespace addressinput 209 } // namespace addressinput
210 } // namespace i18n 210 } // namespace i18n
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/src/address_validator.cc ('k') | third_party/libaddressinput/chromium/cpp/src/rule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698