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

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

Issue 2905733002: [WebPayments] Disabling done button when form invalid (Closed)
Patch Set: upload Created 3 years, 6 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/contact_info_editor_view_controller.h " 5 #include "chrome/browser/ui/views/payments/contact_info_editor_view_controller.h "
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/views/payments/validating_textfield.h" 10 #include "chrome/browser/ui/views/payments/validating_textfield.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 base::string16 ContactInfoEditorViewController::GetSheetTitle() { 119 base::string16 ContactInfoEditorViewController::GetSheetTitle() {
120 // TODO(crbug.com/712074): Title should reflect the missing information, if 120 // TODO(crbug.com/712074): Title should reflect the missing information, if
121 // applicable. 121 // applicable.
122 return profile_to_edit_ ? l10n_util::GetStringUTF16( 122 return profile_to_edit_ ? l10n_util::GetStringUTF16(
123 IDS_PAYMENTS_EDIT_CONTACT_DETAILS_LABEL) 123 IDS_PAYMENTS_EDIT_CONTACT_DETAILS_LABEL)
124 : l10n_util::GetStringUTF16( 124 : l10n_util::GetStringUTF16(
125 IDS_PAYMENTS_ADD_CONTACT_DETAILS_LABEL); 125 IDS_PAYMENTS_ADD_CONTACT_DETAILS_LABEL);
126 } 126 }
127 127
128 bool ContactInfoEditorViewController::ValidateModel() {
129 for (const auto& field : text_fields()) {
130 // Force a blur, as validation only occurs after the first blur.
131 field.first->OnBlur();
132 if (field.first->invalid())
133 return false;
134 }
135 return true;
136 }
137
138 void ContactInfoEditorViewController::PopulateProfile( 128 void ContactInfoEditorViewController::PopulateProfile(
139 autofill::AutofillProfile* profile) { 129 autofill::AutofillProfile* profile) {
140 for (const auto& field : text_fields()) { 130 for (const auto& field : text_fields()) {
141 profile->SetInfo(autofill::AutofillType(field.second.type), 131 profile->SetInfo(autofill::AutofillType(field.second.type),
142 field.first->text(), state()->GetApplicationLocale()); 132 field.first->text(), state()->GetApplicationLocale());
143 } 133 }
144 profile->set_origin(autofill::kSettingsOrigin); 134 profile->set_origin(autofill::kSettingsOrigin);
145 } 135 }
146 136
147 bool ContactInfoEditorViewController::GetSheetId(DialogViewID* sheet_id) { 137 bool ContactInfoEditorViewController::GetSheetId(DialogViewID* sheet_id) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 239 }
250 240
251 bool ContactInfoEditorViewController::ContactInfoValidationDelegate:: 241 bool ContactInfoEditorViewController::ContactInfoValidationDelegate::
252 ComboboxValueChanged(views::Combobox* combobox) { 242 ComboboxValueChanged(views::Combobox* combobox) {
253 // This UI doesn't contain any comboboxes. 243 // This UI doesn't contain any comboboxes.
254 NOTREACHED(); 244 NOTREACHED();
255 return true; 245 return true;
256 } 246 }
257 247
258 } // namespace payments 248 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698