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

Side by Side Diff: chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc

Issue 2823073003: Make Use of Value::GetList API
Patch Set: Further Usages Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h" 5 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (chosen_country_index_ < country_codes_.size()) 247 if (chosen_country_index_ < country_codes_.size())
248 chosen_country_code = country_codes_[chosen_country_index_]; 248 chosen_country_code = country_codes_[chosen_country_index_];
249 249
250 std::unique_ptr<base::ListValue> components(new base::ListValue); 250 std::unique_ptr<base::ListValue> components(new base::ListValue);
251 std::string unused; 251 std::string unused;
252 autofill::GetAddressComponents(chosen_country_code, 252 autofill::GetAddressComponents(chosen_country_code,
253 state()->GetApplicationLocale(), 253 state()->GetApplicationLocale(),
254 components.get(), &unused); 254 components.get(), &unused);
255 for (size_t line_index = 0; line_index < components->GetSize(); 255 for (size_t line_index = 0; line_index < components->GetSize();
256 ++line_index) { 256 ++line_index) {
257 const base::ListValue* line = nullptr; 257 const base::ListValue* line = static_cast<const base::ListValue*>(
258 if (!components->GetList(line_index, &line)) { 258 &components->base::Value::GetList()[line_index]);
259 NOTREACHED();
260 return;
261 }
262 DCHECK_NE(nullptr, line); 259 DCHECK_NE(nullptr, line);
263 for (size_t component_index = 0; component_index < line->GetSize(); 260 for (size_t component_index = 0; component_index < line->GetSize();
264 ++component_index) { 261 ++component_index) {
265 const base::DictionaryValue* component = nullptr; 262 const base::DictionaryValue* component = nullptr;
266 if (!line->GetDictionary(component_index, &component)) { 263 if (!line->GetDictionary(component_index, &component)) {
267 NOTREACHED(); 264 NOTREACHED();
268 return; 265 return;
269 } 266 }
270 std::string field_type; 267 std::string field_type;
271 if (!component->GetString(autofill::kFieldTypeKey, &field_type)) { 268 if (!component->GetString(autofill::kFieldTypeKey, &field_type)) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 bool is_required_valid = !field_.required; 386 bool is_required_valid = !field_.required;
390 const base::string16 displayed_message = 387 const base::string16 displayed_message =
391 is_required_valid ? base::ASCIIToUTF16("") 388 is_required_valid ? base::ASCIIToUTF16("")
392 : l10n_util::GetStringUTF16( 389 : l10n_util::GetStringUTF16(
393 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 390 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
394 controller_->DisplayErrorMessageForField(field_, displayed_message); 391 controller_->DisplayErrorMessageForField(field_, displayed_message);
395 return is_required_valid; 392 return is_required_valid;
396 } 393 }
397 394
398 } // namespace payments 395 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698