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

Side by Side Diff: chrome/browser/ui/autofill/data_model_wrapper.cc

Issue 63053003: Ask libaddressinput for address components to use in requestAutocomplete(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: let's try this again, android Created 7 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill/data_model_wrapper.h" 5 #include "chrome/browser/ui/autofill/data_model_wrapper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" 11 #include "chrome/browser/ui/autofill/autofill_dialog_common.h"
12 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 12 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
13 #include "components/autofill/content/browser/wallet/full_wallet.h" 13 #include "components/autofill/content/browser/wallet/full_wallet.h"
14 #include "components/autofill/content/browser/wallet/wallet_address.h" 14 #include "components/autofill/content/browser/wallet/wallet_address.h"
15 #include "components/autofill/content/browser/wallet/wallet_items.h" 15 #include "components/autofill/content/browser/wallet/wallet_items.h"
16 #include "components/autofill/core/browser/autofill_data_model.h" 16 #include "components/autofill/core/browser/autofill_data_model.h"
17 #include "components/autofill/core/browser/autofill_field.h" 17 #include "components/autofill/core/browser/autofill_field.h"
18 #include "components/autofill/core/browser/autofill_profile.h" 18 #include "components/autofill/core/browser/autofill_profile.h"
19 #include "components/autofill/core/browser/autofill_type.h" 19 #include "components/autofill/core/browser/autofill_type.h"
20 #include "components/autofill/core/browser/credit_card.h" 20 #include "components/autofill/core/browser/credit_card.h"
21 #include "components/autofill/core/browser/form_structure.h" 21 #include "components/autofill/core/browser/form_structure.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
24 24
25 namespace autofill { 25 namespace autofill {
26 26
27 DataModelWrapper::~DataModelWrapper() {} 27 DataModelWrapper::~DataModelWrapper() {}
28 28
29 void DataModelWrapper::FillInputs(DetailInputs* inputs) { 29 void DataModelWrapper::FillInputs(DetailInputs* inputs,
30 const std::string& country_code) {
30 for (size_t i = 0; i < inputs->size(); ++i) { 31 for (size_t i = 0; i < inputs->size(); ++i) {
31 DetailInput* input = &(*inputs)[i]; 32 DetailInput* input = &(*inputs)[i];
32 input->initial_value = common::GetHardcodedValueForType(input->type); 33 input->initial_value = common::GetInitialValueForType(input->type,
34 country_code);
33 if (input->initial_value.empty()) 35 if (input->initial_value.empty())
34 input->initial_value = GetInfo(AutofillType(input->type)); 36 input->initial_value = GetInfo(AutofillType(input->type));
35 } 37 }
36 } 38 }
37 39
38 base::string16 DataModelWrapper::GetInfoForDisplay(const AutofillType& type) 40 base::string16 DataModelWrapper::GetInfoForDisplay(const AutofillType& type)
39 const { 41 const {
40 return GetInfo(type); 42 return GetInfo(type);
41 } 43 }
42 44
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 : field_map_(field_map) {} 361 : field_map_(field_map) {}
360 362
361 FieldMapWrapper::~FieldMapWrapper() {} 363 FieldMapWrapper::~FieldMapWrapper() {}
362 364
363 base::string16 FieldMapWrapper::GetInfo(const AutofillType& type) const { 365 base::string16 FieldMapWrapper::GetInfo(const AutofillType& type) const {
364 FieldValueMap::const_iterator it = field_map_.find(type.server_type()); 366 FieldValueMap::const_iterator it = field_map_.find(type.server_type());
365 return it != field_map_.end() ? it->second : base::string16(); 367 return it != field_map_.end() ? it->second : base::string16();
366 } 368 }
367 369
368 } // namespace autofill 370 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698