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

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2888733004: Change text and disable empty combobox for payment request shipping address (Closed)
Patch Set: Fixed a weird goof Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/views/payments/credit_card_editor_view_controller.h" 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 *state()->GetPersonalDataManager(), state()->GetApplicationLocale(), 328 *state()->GetPersonalDataManager(), state()->GetApplicationLocale(),
329 credit_card_to_edit_ ? credit_card_to_edit_->billing_address_id() 329 credit_card_to_edit_ ? credit_card_to_edit_->billing_address_id()
330 : ""); 330 : "");
331 default: 331 default:
332 NOTREACHED(); 332 NOTREACHED();
333 break; 333 break;
334 } 334 }
335 return std::unique_ptr<ui::ComboboxModel>(); 335 return std::unique_ptr<ui::ComboboxModel>();
336 } 336 }
337 337
338 void CreditCardEditorViewController::FillContentView(
339 views::View* content_view) {
340 EditorViewController::FillContentView(content_view);
341 // We need to search from the content view here, since the dialog may not have
342 // the content view added to it yet.
343 views::Combobox* combobox = static_cast<views::Combobox*>(
344 content_view->GetViewByID(kBillingAddressType));
345 // When the combobox has a single item, it's because it has no addresses
346 // (otherwise, it would have the select header, and a separator before the
347 // first address to choose from).
348 DCHECK(combobox);
349 combobox->SetEnabled(combobox->GetRowCount() > 1);
350 }
351
338 base::string16 CreditCardEditorViewController::GetSheetTitle() { 352 base::string16 CreditCardEditorViewController::GetSheetTitle() {
339 if (!credit_card_to_edit_) 353 if (!credit_card_to_edit_)
340 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD); 354 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD);
341 355
342 // Gets the completion message, or empty if nothing is missing from the card. 356 // Gets the completion message, or empty if nothing is missing from the card.
343 base::string16 title = autofill::GetCompletionMessageForCard( 357 base::string16 title = autofill::GetCompletionMessageForCard(
344 autofill::GetCompletionStatusForCard( 358 autofill::GetCompletionStatusForCard(
345 *credit_card_to_edit_, state()->GetApplicationLocale(), 359 *credit_card_to_edit_, state()->GetApplicationLocale(),
346 state()->GetPersonalDataManager()->GetProfiles())); 360 state()->GetPersonalDataManager()->GetProfiles()));
347 return title.empty() ? l10n_util::GetStringUTF16(IDS_PAYMENTS_EDIT_CARD) 361 return title.empty() ? l10n_util::GetStringUTF16(IDS_PAYMENTS_EDIT_CARD)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 controller_->DisplayErrorMessageForField(field_, displayed_message); 443 controller_->DisplayErrorMessageForField(field_, displayed_message);
430 return is_required_valid; 444 return is_required_valid;
431 } 445 }
432 446
433 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { 447 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) {
434 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; 448 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET;
435 return true; 449 return true;
436 } 450 }
437 451
438 } // namespace payments 452 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698