Remove Combobox::ModelChanged And Use ComboboxModelObserver Instead
ComboboxModelObserver already exists that provides this functionality,
and ComboboxModel implementors already presume the existence of
ComboboxModelObserver via ComboboxModel::[Add|Remove]Observer.
Additionally, consumers of Combobox really shouldn't manually
call Combobox::ModelChanged(). This should be handled on the model
and the model itself needs to signal when changes occur.
This change as a result has the Combobox start listening to model
changes a la ComboboxModelObserver. This is a no-op for read-only
models as they get the no-op [Add|Remove]Observer default
implementation.
Dependent components have also been updated to account for this change
in behavior.
BUG=946299
Change-Id: Ie71949685dfa8015bad6fdb973512b7efb38c7a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610229
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Robert Liao <[email protected]>
Cr-Commit-Position: refs/heads/master@{#659676}
diff --git a/chrome/browser/ui/views/payments/validating_combobox.h b/chrome/browser/ui/views/payments/validating_combobox.h
index 1714ec29..fcc2660f 100644
--- a/chrome/browser/ui/views/payments/validating_combobox.h
+++ b/chrome/browser/ui/views/payments/validating_combobox.h
@@ -14,8 +14,7 @@
namespace payments {
-class ValidatingCombobox : public views::Combobox,
- public ui::ComboboxModelObserver {
+class ValidatingCombobox : public views::Combobox {
public:
ValidatingCombobox(std::unique_ptr<ui::ComboboxModel> model,
std::unique_ptr<ValidationDelegate> delegate);
@@ -31,7 +30,7 @@
// Called when the combobox contents is changed. May do validation.
void OnContentsChanged();
- // ui::ComboboxModelObserver:
+ // views::Combobox:
void OnComboboxModelChanged(ui::ComboboxModel* model) override;
// Identifies whether the current content if valid or not.