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

Unified Diff: chrome/browser/ui/views/payments/validating_combobox.h

Issue 2689363004: [Payments] Add combobox support to editors. (Closed)
Patch Set: fix test Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/validating_combobox.h
diff --git a/chrome/browser/ui/views/payments/validating_combobox.h b/chrome/browser/ui/views/payments/validating_combobox.h
new file mode 100644
index 0000000000000000000000000000000000000000..3410f4a4a5104c4266c08e792c4e3e49512a579c
--- /dev/null
+++ b/chrome/browser/ui/views/payments/validating_combobox.h
@@ -0,0 +1,40 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_
+
+#include "base/macros.h"
+#include "chrome/browser/ui/views/payments/validation_delegate.h"
+#include "ui/views/controls/combobox/combobox.h"
+
+namespace payments {
+
+class ValidatingCombobox : public views::Combobox {
+ public:
+ explicit ValidatingCombobox(std::unique_ptr<ui::ComboboxModel> model,
please use gerrit instead 2017/02/15 15:59:39 No need for "explicit" keyword with more than one
Mathieu 2017/02/15 19:55:51 Done.
+ std::unique_ptr<ValidationDelegate> delegate);
+ ~ValidatingCombobox() override;
+
+ // Combobox:
+ // The first validation will happen on blur.
+ void OnBlur() override;
+
+ // Called when the combobox contents is changed. May do validation.
+ void OnContentsChanged();
+
+ private:
+ // Will call to the ValidationDelegate to validate the contents of the
+ // combobox.
+ void Validate();
+
+ std::unique_ptr<ValidationDelegate> delegate_;
+ bool was_validated_ = false;
please use gerrit instead 2017/02/15 15:59:39 Haven't see this done before. Perhaps it's best to
Mathieu 2017/02/15 19:55:51 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(ValidatingCombobox);
+};
+
+} // namespace payments
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VALIDATING_COMBOBOX_H_

Powered by Google App Engine
This is Rietveld 408576698