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

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

Issue 58683002: rAc: fix validation logic when autofill completion sets country (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix filling as well as validation Created 7 years, 1 month 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_models.h" 12 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
12 #include "components/autofill/content/browser/wallet/full_wallet.h" 13 #include "components/autofill/content/browser/wallet/full_wallet.h"
13 #include "components/autofill/content/browser/wallet/wallet_address.h" 14 #include "components/autofill/content/browser/wallet/wallet_address.h"
14 #include "components/autofill/content/browser/wallet/wallet_items.h" 15 #include "components/autofill/content/browser/wallet/wallet_items.h"
15 #include "components/autofill/core/browser/autofill_data_model.h" 16 #include "components/autofill/core/browser/autofill_data_model.h"
16 #include "components/autofill/core/browser/autofill_field.h" 17 #include "components/autofill/core/browser/autofill_field.h"
17 #include "components/autofill/core/browser/autofill_profile.h" 18 #include "components/autofill/core/browser/autofill_profile.h"
18 #include "components/autofill/core/browser/autofill_type.h" 19 #include "components/autofill/core/browser/autofill_type.h"
19 #include "components/autofill/core/browser/credit_card.h" 20 #include "components/autofill/core/browser/credit_card.h"
20 #include "components/autofill/core/browser/form_structure.h" 21 #include "components/autofill/core/browser/form_structure.h"
21 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
23 24
24 namespace autofill { 25 namespace autofill {
25 26
26 DataModelWrapper::~DataModelWrapper() {} 27 DataModelWrapper::~DataModelWrapper() {}
27 28
28 void DataModelWrapper::FillInputs(DetailInputs* inputs) { 29 void DataModelWrapper::FillInputs(DetailInputs* inputs) {
29 for (size_t i = 0; i < inputs->size(); ++i) { 30 for (size_t i = 0; i < inputs->size(); ++i) {
Dan Beam 2013/11/05 02:54:43 nit: DetailInput* input = &(*inputs)[i];
30 (*inputs)[i].initial_value = GetInfo(AutofillType((*inputs)[i].type)); 31 (*inputs)[i].initial_value = common::GetHardcodedValueForType(
32 (*inputs)[i].type);
33 if ((*inputs)[i].initial_value.empty())
34 (*inputs)[i].initial_value = GetInfo(AutofillType((*inputs)[i].type));
31 } 35 }
32 } 36 }
33 37
34 base::string16 DataModelWrapper::GetInfoForDisplay(const AutofillType& type) 38 base::string16 DataModelWrapper::GetInfoForDisplay(const AutofillType& type)
35 const { 39 const {
36 return GetInfo(type); 40 return GetInfo(type);
37 } 41 }
38 42
39 gfx::Image DataModelWrapper::GetIcon() { 43 gfx::Image DataModelWrapper::GetIcon() {
40 return gfx::Image(); 44 return gfx::Image();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 ServerFieldType storable_type = type.GetStorableType(); 364 ServerFieldType storable_type = type.GetStorableType();
361 for (DetailOutputMap::const_iterator it = outputs_.begin(); 365 for (DetailOutputMap::const_iterator it = outputs_.begin();
362 it != outputs_.end(); ++it) { 366 it != outputs_.end(); ++it) {
363 if (storable_type == AutofillType(it->first->type).GetStorableType()) 367 if (storable_type == AutofillType(it->first->type).GetStorableType())
364 return it->second; 368 return it->second;
365 } 369 }
366 return base::string16(); 370 return base::string16();
367 } 371 }
368 372
369 } // namespace autofill 373 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698