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

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

Issue 2922483002: [WebPayments] Making all fields and buttons focusable (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 | « chrome/browser/ui/views/payments/profile_list_view_controller.cc ('k') | no next file » | 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/validating_combobox.h" 5 #include "chrome/browser/ui/views/payments/validating_combobox.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ui/base/models/combobox_model.h" 9 #include "ui/base/models/combobox_model.h"
10 10
11 namespace payments { 11 namespace payments {
12 12
13 ValidatingCombobox::ValidatingCombobox( 13 ValidatingCombobox::ValidatingCombobox(
14 std::unique_ptr<ui::ComboboxModel> model, 14 std::unique_ptr<ui::ComboboxModel> model,
15 std::unique_ptr<ValidationDelegate> delegate) 15 std::unique_ptr<ValidationDelegate> delegate)
16 : Combobox(std::move(model)), delegate_(std::move(delegate)) { 16 : Combobox(std::move(model)), delegate_(std::move(delegate)) {
17 // No need to remove observer on owned model. 17 // No need to remove observer on owned model.
18 this->model()->AddObserver(this); 18 this->model()->AddObserver(this);
19 SetFocusBehavior(FocusBehavior::ALWAYS);
19 } 20 }
20 21
21 ValidatingCombobox::~ValidatingCombobox() {} 22 ValidatingCombobox::~ValidatingCombobox() {}
22 23
23 void ValidatingCombobox::OnBlur() { 24 void ValidatingCombobox::OnBlur() {
24 Combobox::OnBlur(); 25 Combobox::OnBlur();
25 26
26 // Validations will occur when the content changes. Do not validate if the 27 // Validations will occur when the content changes. Do not validate if the
27 // view is being removed. 28 // view is being removed.
28 if (!being_removed_) { 29 if (!being_removed_) {
(...skipping 20 matching lines...) Expand all
49 bool ValidatingCombobox::IsValid() { 50 bool ValidatingCombobox::IsValid() {
50 return delegate_->IsValidCombobox(this); 51 return delegate_->IsValidCombobox(this);
51 } 52 }
52 53
53 void ValidatingCombobox::Validate() { 54 void ValidatingCombobox::Validate() {
54 // ComboboxValueChanged may have side-effects, such as displaying errors. 55 // ComboboxValueChanged may have side-effects, such as displaying errors.
55 SetInvalid(!delegate_->ComboboxValueChanged(this)); 56 SetInvalid(!delegate_->ComboboxValueChanged(this));
56 } 57 }
57 58
58 } // namespace payments 59 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/profile_list_view_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698