Commit 2335b03d authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove SearchBoxModel::selection_model

It doesn't seem to be useful any longer. It's only set by SearchBoxView
when the search box text input changes, and it's only read by
SearchBoxView to update the search box text input when the model value
is changed (which seems a bit redundant). Additionally, SearchBoxView
stops observing the model while it's updating the selection, which means
that SearchBoxView::SelectionModelChanged  (the only code that actually
accesses the search model's selection model) doesn't ever get called.

Change-Id: I7e9489ea703942f7759162e5e3527f438c143e8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1925287Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716921}
parent ab1a7a8f
......@@ -41,15 +41,6 @@ void SearchBoxModel::UpdateAccessibleName() {
observer.HintTextChanged();
}
void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) {
if (selection_model_ == sel)
return;
selection_model_ = sel;
for (auto& observer : observers_)
observer.SelectionModelChanged();
}
void SearchBoxModel::SetTabletMode(bool is_tablet_mode) {
if (is_tablet_mode == is_tablet_mode_)
return;
......
......@@ -43,12 +43,6 @@ class APP_LIST_MODEL_EXPORT SearchBoxModel {
void UpdateAccessibleName();
const base::string16& accessible_name() const { return accessible_name_; }
// Sets/gets the selection model for the search box's Textfield.
void SetSelectionModel(const gfx::SelectionModel& sel);
const gfx::SelectionModel& selection_model() const {
return selection_model_;
}
void SetTabletMode(bool is_tablet_mode);
bool is_tablet_mode() const { return is_tablet_mode_; }
......@@ -72,7 +66,6 @@ class APP_LIST_MODEL_EXPORT SearchBoxModel {
base::string16 tablet_accessible_name_;
base::string16 clamshell_accessible_name_;
base::string16 accessible_name_;
gfx::SelectionModel selection_model_;
base::string16 text_;
bool search_engine_is_google_ = false;
bool is_tablet_mode_ = false;
......
......@@ -14,9 +14,6 @@ class APP_LIST_MODEL_EXPORT SearchBoxModelObserver {
// Invoked when hint text is changed.
virtual void HintTextChanged() = 0;
// Invoked when selection model is changed.
virtual void SelectionModelChanged() = 0;
// Invoked when text or voice search flag is changed.
virtual void Update() = 0;
......
......@@ -173,8 +173,6 @@ void SearchBoxView::UpdateModel(bool initiated_by_user) {
search_model_->search_box()->RemoveObserver(this);
search_model_->search_box()->Update(search_box()->GetText(),
initiated_by_user);
search_model_->search_box()->SetSelectionModel(
search_box()->GetSelectionModel());
search_model_->search_box()->AddObserver(this);
}
......@@ -750,11 +748,6 @@ void SearchBoxView::HintTextChanged() {
SchedulePaint();
}
void SearchBoxView::SelectionModelChanged() {
search_box()->SelectSelectionModel(
search_model_->search_box()->selection_model());
}
void SearchBoxView::Update() {
search_box()->SetText(search_model_->search_box()->text());
UpdateButtonsVisisbility();
......
......@@ -142,7 +142,6 @@ class APP_LIST_EXPORT SearchBoxView : public search_box::SearchBoxViewBase,
// Overridden from SearchBoxModelObserver:
void HintTextChanged() override;
void SelectionModelChanged() override;
void Update() override;
void SearchEngineChanged() override;
void ShowAssistantChanged() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment