OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 #include "grit/component_strings.h" | 79 #include "grit/component_strings.h" |
80 #include "grit/generated_resources.h" | 80 #include "grit/generated_resources.h" |
81 #include "grit/libaddressinput_strings.h" | 81 #include "grit/libaddressinput_strings.h" |
82 #include "grit/platform_locale_settings.h" | 82 #include "grit/platform_locale_settings.h" |
83 #include "grit/theme_resources.h" | 83 #include "grit/theme_resources.h" |
84 #include "net/cert/cert_status_flags.h" | 84 #include "net/cert/cert_status_flags.h" |
85 #include "third_party/libaddressinput/chromium/chrome_downloader_impl.h" | 85 #include "third_party/libaddressinput/chromium/chrome_downloader_impl.h" |
86 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" | 86 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" |
87 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h" | 87 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_data.h" |
88 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_problem.h" | 88 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_problem.h" |
89 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre ss_ui.h" | |
89 #include "ui/base/base_window.h" | 90 #include "ui/base/base_window.h" |
90 #include "ui/base/l10n/l10n_util.h" | 91 #include "ui/base/l10n/l10n_util.h" |
91 #include "ui/base/models/combobox_model.h" | 92 #include "ui/base/models/combobox_model.h" |
92 #include "ui/base/resource/resource_bundle.h" | 93 #include "ui/base/resource/resource_bundle.h" |
93 #include "ui/gfx/canvas.h" | 94 #include "ui/gfx/canvas.h" |
94 #include "ui/gfx/image/image_skia_operations.h" | 95 #include "ui/gfx/image/image_skia_operations.h" |
95 #include "ui/gfx/skia_util.h" | 96 #include "ui/gfx/skia_util.h" |
96 | 97 |
97 using ::i18n::addressinput::AddressData; | 98 using ::i18n::addressinput::AddressData; |
98 using ::i18n::addressinput::AddressField; | 99 using ::i18n::addressinput::AddressField; |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2134 // |popup_input_type_| must be set before calling |Show()|. | 2135 // |popup_input_type_| must be set before calling |Show()|. |
2135 popup_input_type_ = type; | 2136 popup_input_type_ = type; |
2136 | 2137 |
2137 // TODO(estade): do we need separators and control rows like 'Clear | 2138 // TODO(estade): do we need separators and control rows like 'Clear |
2138 // Form'? | 2139 // Form'? |
2139 std::vector<int> popup_ids; | 2140 std::vector<int> popup_ids; |
2140 for (size_t i = 0; i < popup_values.size(); ++i) { | 2141 for (size_t i = 0; i < popup_values.size(); ++i) { |
2141 popup_ids.push_back(i); | 2142 popup_ids.push_back(i); |
2142 } | 2143 } |
2143 | 2144 |
2145 // Names need to be in vertically compact form - i.e. a single line. Join | |
2146 // multi-line names into a single line, using a separator. | |
2147 // The separator is locale-specific. | |
2148 base::string16 compact_separator = | |
2149 base::UTF8ToUTF16(::i18n::addressinput::GetCompactAddressLinesSeparator( | |
2150 AddressLanguageCodeForSection(section))); | |
2151 for (size_t i = 0; i < popup_values.size(); ++i) { | |
2152 std::vector<base::string16> lines; | |
2153 base::SplitString(popup_values[i], '\n', &lines); | |
2154 popup_values[i] = (JoinString(lines, compact_separator)); | |
2155 } | |
Evan Stade
2014/05/07 00:46:16
This needs to be done in GetProfileSuggestions so
| |
2156 | |
2144 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( | 2157 popup_controller_ = AutofillPopupControllerImpl::GetOrCreate( |
2145 popup_controller_, | 2158 popup_controller_, |
2146 weak_ptr_factory_.GetWeakPtr(), | 2159 weak_ptr_factory_.GetWeakPtr(), |
2147 NULL, | 2160 NULL, |
2148 parent_view, | 2161 parent_view, |
2149 content_bounds, | 2162 content_bounds, |
2150 base::i18n::IsRTL() ? | 2163 base::i18n::IsRTL() ? |
2151 base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT); | 2164 base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT); |
2152 popup_controller_->Show(popup_values, | 2165 popup_controller_->Show(popup_values, |
2153 popup_labels, | 2166 popup_labels, |
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4081 view_->UpdateButtonStrip(); | 4094 view_->UpdateButtonStrip(); |
4082 } | 4095 } |
4083 | 4096 |
4084 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4097 void AutofillDialogControllerImpl::FetchWalletCookie() { |
4085 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4098 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
4086 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4099 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
4087 signin_helper_->StartWalletCookieValueFetch(); | 4100 signin_helper_->StartWalletCookieValueFetch(); |
4088 } | 4101 } |
4089 | 4102 |
4090 } // namespace autofill | 4103 } // namespace autofill |
OLD | NEW |