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

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

Issue 211443003: Revert of Determine language code and type of format for address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/country_combobox_model_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autofill_dialog_i18n_input.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h"
10 #include "components/autofill/core/browser/autofill_profile.h" 9 #include "components/autofill/core/browser/autofill_profile.h"
11 #include "components/autofill/core/browser/credit_card.h" 10 #include "components/autofill/core/browser/credit_card.h"
12 #include "components/autofill/core/browser/field_types.h" 11 #include "components/autofill/core/browser/field_types.h"
13 #include "grit/component_strings.h" 12 #include "grit/component_strings.h"
14 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h" 13 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h"
15 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_field.h" 14 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_field.h"
16 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_ui.h" 15 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_ui.h"
17 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_ui_component.h" 16 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_ui_component.h"
18 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
19 18
(...skipping 12 matching lines...) Expand all
32 return DetailInput::SHORT; 31 return DetailInput::SHORT;
33 DCHECK_EQ(hint, AddressUiComponent::HINT_LONG); 32 DCHECK_EQ(hint, AddressUiComponent::HINT_LONG);
34 return DetailInput::LONG; 33 return DetailInput::LONG;
35 } 34 }
36 35
37 } // namespace 36 } // namespace
38 37
39 void BuildAddressInputs(common::AddressType address_type, 38 void BuildAddressInputs(common::AddressType address_type,
40 const std::string& country_code, 39 const std::string& country_code,
41 DetailInputs* inputs) { 40 DetailInputs* inputs) {
42 // TODO(rouslan): Store the language code for the autofill profile.
43 // http://crbug.com/354955
44 std::vector<AddressUiComponent> components( 41 std::vector<AddressUiComponent> components(
45 ::i18n::addressinput::BuildComponents( 42 ::i18n::addressinput::BuildComponents(country_code));
46 country_code, g_browser_process->GetApplicationLocale(), NULL));
47 43
48 const bool billing = address_type == common::ADDRESS_TYPE_BILLING; 44 const bool billing = address_type == common::ADDRESS_TYPE_BILLING;
49 45
50 for (size_t i = 0; i < components.size(); ++i) { 46 for (size_t i = 0; i < components.size(); ++i) {
51 const AddressUiComponent& component = components[i]; 47 const AddressUiComponent& component = components[i];
52 if (component.field == ::i18n::addressinput::ORGANIZATION) { 48 if (component.field == ::i18n::addressinput::ORGANIZATION) {
53 // TODO(dbeam): figure out when we actually need this. 49 // TODO(dbeam): figure out when we actually need this.
54 continue; 50 continue;
55 } 51 }
56 52
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 get_info.Run(AutofillType(ADDRESS_HOME_ZIP))); 235 get_info.Run(AutofillType(ADDRESS_HOME_ZIP)));
240 base::SplitString( 236 base::SplitString(
241 UTF16ToUTF8(get_info.Run(AutofillType(ADDRESS_HOME_STREET_ADDRESS))), 237 UTF16ToUTF8(get_info.Run(AutofillType(ADDRESS_HOME_STREET_ADDRESS))),
242 '\n', 238 '\n',
243 &address_data->address_lines); 239 &address_data->address_lines);
244 } 240 }
245 241
246 bool CountryIsFullySupported(const std::string& country_code) { 242 bool CountryIsFullySupported(const std::string& country_code) {
247 DCHECK_EQ(2U, country_code.size()); 243 DCHECK_EQ(2U, country_code.size());
248 std::vector< ::i18n::addressinput::AddressUiComponent> components = 244 std::vector< ::i18n::addressinput::AddressUiComponent> components =
249 ::i18n::addressinput::BuildComponents( 245 ::i18n::addressinput::BuildComponents(country_code);
250 country_code, g_browser_process->GetApplicationLocale(), NULL);
251 for (size_t i = 0; i < components.size(); ++i) { 246 for (size_t i = 0; i < components.size(); ++i) {
252 if (components[i].field == ::i18n::addressinput::DEPENDENT_LOCALITY) 247 if (components[i].field == ::i18n::addressinput::DEPENDENT_LOCALITY)
253 return false; 248 return false;
254 } 249 }
255 return true; 250 return true;
256 } 251 }
257 252
258 } // namespace i18ninput 253 } // namespace i18ninput
259 } // namespace autofill 254 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/country_combobox_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698