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

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

Issue 2931503002: [Payments] Improve some accessibility labels in editors (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/editor_view_controller.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 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, 273 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
274 views::GridLayout::USE_PREF, 0, 0); 274 views::GridLayout::USE_PREF, 0, 0);
275 // Space between the two comboboxes. 275 // Space between the two comboboxes.
276 constexpr int kHorizontalSpacing = 8; 276 constexpr int kHorizontalSpacing = 8;
277 columns->AddPaddingColumn(0, kHorizontalSpacing); 277 columns->AddPaddingColumn(0, kHorizontalSpacing);
278 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, 278 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1,
279 views::GridLayout::USE_PREF, 0, 0); 279 views::GridLayout::USE_PREF, 0, 0);
280 280
281 combobox_layout->StartRow(0, 0); 281 combobox_layout->StartRow(0, 0);
282 constexpr int kInputFieldHeight = 28; 282 constexpr int kInputFieldHeight = 28;
283 EditorField tmp_month{autofill::CREDIT_CARD_EXP_MONTH, base::string16(), 283 EditorField tmp_month{
284 EditorField::LengthHint::HINT_SHORT, 284 autofill::CREDIT_CARD_EXP_MONTH,
285 /*required=*/true, 285 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_MONTH),
286 EditorField::ControlType::COMBOBOX}; 286 EditorField::LengthHint::HINT_SHORT,
287 /*required=*/true, EditorField::ControlType::COMBOBOX};
287 std::unique_ptr<ValidatingCombobox> month_combobox = 288 std::unique_ptr<ValidatingCombobox> month_combobox =
288 CreateComboboxForField(tmp_month); 289 CreateComboboxForField(tmp_month);
289 *focusable_field = month_combobox.get(); 290 *focusable_field = month_combobox.get();
290 combobox_layout->AddView(month_combobox.release(), 1, 1, 291 combobox_layout->AddView(month_combobox.release(), 1, 1,
291 views::GridLayout::FILL, views::GridLayout::FILL, 292 views::GridLayout::FILL, views::GridLayout::FILL,
292 0, kInputFieldHeight); 293 0, kInputFieldHeight);
293 294
294 EditorField tmp_year{autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, 295 EditorField tmp_year{
295 base::string16(), EditorField::LengthHint::HINT_SHORT, 296 autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR,
296 /*required=*/true, EditorField::ControlType::COMBOBOX}; 297 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_YEAR),
298 EditorField::LengthHint::HINT_SHORT,
299 /*required=*/true, EditorField::ControlType::COMBOBOX};
297 std::unique_ptr<ValidatingCombobox> year_combobox = 300 std::unique_ptr<ValidatingCombobox> year_combobox =
298 CreateComboboxForField(tmp_year); 301 CreateComboboxForField(tmp_year);
299 combobox_layout->AddView(year_combobox.release(), 1, 1, 302 combobox_layout->AddView(year_combobox.release(), 1, 1,
300 views::GridLayout::FILL, views::GridLayout::FILL, 303 views::GridLayout::FILL, views::GridLayout::FILL,
301 0, kInputFieldHeight); 304 0, kInputFieldHeight);
302 view->SetLayoutManager(combobox_layout.release()); 305 view->SetLayoutManager(combobox_layout.release());
303 } 306 }
304 307
305 // Set the initial validity of the custom view. 308 // Set the initial validity of the custom view.
306 base::string16 month = 309 base::string16 month =
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()), 713 return ValidateValue(combobox->GetTextForRow(combobox->selected_index()),
711 error_message); 714 error_message);
712 } 715 }
713 716
714 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { 717 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) {
715 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; 718 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET;
716 return true; 719 return true;
717 } 720 }
718 721
719 } // namespace payments 722 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/editor_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698