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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 const std::vector<wallet::Address*>& addresses, | 288 const std::vector<wallet::Address*>& addresses, |
289 const wallet::Address& address) { | 289 const wallet::Address& address) { |
290 for (size_t i = 0; i < addresses.size(); ++i) { | 290 for (size_t i = 0; i < addresses.size(); ++i) { |
291 if (addresses[i]->EqualsIgnoreID(address)) | 291 if (addresses[i]->EqualsIgnoreID(address)) |
292 return addresses[i]; | 292 return addresses[i]; |
293 } | 293 } |
294 return NULL; | 294 return NULL; |
295 } | 295 } |
296 | 296 |
297 bool IsCardHolderNameValidForWallet(const base::string16& name) { | 297 bool IsCardHolderNameValidForWallet(const base::string16& name) { |
298 base::string16 whitespace_collapsed_name = | 298 return base::SplitStringPiece(name, base::string16(1, ' '), |
299 base::CollapseWhitespace(name, true); | 299 base::KEEP_WHITESPACE, |
300 std::vector<base::string16> split_name; | 300 base::SPLIT_WANT_NONEMPTY).size() >= 2; |
301 base::SplitString(whitespace_collapsed_name, ' ', &split_name); | |
302 return split_name.size() >= 2; | |
303 } | 301 } |
304 | 302 |
305 DialogSection SectionFromLocation(wallet::FormFieldError::Location location) { | 303 DialogSection SectionFromLocation(wallet::FormFieldError::Location location) { |
306 switch (location) { | 304 switch (location) { |
307 case wallet::FormFieldError::PAYMENT_INSTRUMENT: | 305 case wallet::FormFieldError::PAYMENT_INSTRUMENT: |
308 case wallet::FormFieldError::LEGAL_ADDRESS: | 306 case wallet::FormFieldError::LEGAL_ADDRESS: |
309 return SECTION_CC_BILLING; | 307 return SECTION_CC_BILLING; |
310 | 308 |
311 case wallet::FormFieldError::SHIPPING_ADDRESS: | 309 case wallet::FormFieldError::SHIPPING_ADDRESS: |
312 return SECTION_SHIPPING; | 310 return SECTION_SHIPPING; |
(...skipping 3804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4117 view_->UpdateButtonStrip(); | 4115 view_->UpdateButtonStrip(); |
4118 } | 4116 } |
4119 | 4117 |
4120 void AutofillDialogControllerImpl::FetchWalletCookie() { | 4118 void AutofillDialogControllerImpl::FetchWalletCookie() { |
4121 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 4119 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
4122 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 4120 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
4123 signin_helper_->StartWalletCookieValueFetch(); | 4121 signin_helper_->StartWalletCookieValueFetch(); |
4124 } | 4122 } |
4125 | 4123 |
4126 } // namespace autofill | 4124 } // namespace autofill |
OLD | NEW |