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

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

Issue 2881643002: Focus first invalid field of payment request editor (Closed)
Patch Set: Last final nit :-) 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/validating_textfield.h" 5 #include "chrome/browser/ui/views/payments/validating_textfield.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 namespace payments { 9 namespace payments {
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 void ValidatingTextfield::OnContentsChanged() { 35 void ValidatingTextfield::OnContentsChanged() {
36 // Validation on every keystroke only happens if the field has been validated 36 // Validation on every keystroke only happens if the field has been validated
37 // before as part of a blur. 37 // before as part of a blur.
38 if (!was_blurred_) 38 if (!was_blurred_)
39 return; 39 return;
40 40
41 Validate(); 41 Validate();
42 } 42 }
43 43
44 bool ValidatingTextfield::IsValid() {
45 bool valid = delegate_->IsValidTextfield(this);
46 SetInvalid(!valid);
47 return valid;
48 }
49
44 void ValidatingTextfield::Validate() { 50 void ValidatingTextfield::Validate() {
45 // ValidateTextfield may have side-effects, such as displaying errors. 51 // TextfieldValueChanged may have side-effects, such as displaying errors.
46 SetInvalid(!delegate_->ValidateTextfield(this)); 52 SetInvalid(!delegate_->TextfieldValueChanged(this));
47 } 53 }
48 54
49 } // namespace payments 55 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698