Commit ae174f80 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Encapsulate an accessibility call

After a previous change, it was apparent that OmniboxEditModel was
exposing more members than it needed to, and that the code was a
little more complicated than necessary. This CL encapsulates the
call, so that no data needs to be public, and the code is simpler.

Change-Id: Ibb3dcc23148d1e2568f54a9645de4c4267e3d2b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903619Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713703}
parent d5cb613c
...@@ -1475,6 +1475,10 @@ void OmniboxEditModel::OnCurrentMatchChanged() { ...@@ -1475,6 +1475,10 @@ void OmniboxEditModel::OnCurrentMatchChanged() {
const char OmniboxEditModel::kCutOrCopyAllTextHistogram[] = const char OmniboxEditModel::kCutOrCopyAllTextHistogram[] =
"Omnibox.CutOrCopyAllText"; "Omnibox.CutOrCopyAllText";
void OmniboxEditModel::SetAccessibilityLabel(const AutocompleteMatch& match) {
view_->SetAccessibilityLabel(view_->GetText(), match);
}
bool OmniboxEditModel::PopupIsOpen() const { bool OmniboxEditModel::PopupIsOpen() const {
return popup_model() && popup_model()->IsOpen(); return popup_model() && popup_model()->IsOpen();
} }
......
...@@ -385,7 +385,8 @@ class OmniboxEditModel { ...@@ -385,7 +385,8 @@ class OmniboxEditModel {
// Name of the histogram tracking cut or copy omnibox commands. // Name of the histogram tracking cut or copy omnibox commands.
static const char kCutOrCopyAllTextHistogram[]; static const char kCutOrCopyAllTextHistogram[];
OmniboxView* view() { return view_; } // Just forwards the call to the OmniboxView referred within.
void SetAccessibilityLabel(const AutocompleteMatch& match);
private: private:
friend class OmniboxControllerTest; friend class OmniboxControllerTest;
......
...@@ -195,8 +195,7 @@ void OmniboxPopupModel::SetSelectedLineState(LineState state) { ...@@ -195,8 +195,7 @@ void OmniboxPopupModel::SetSelectedLineState(LineState state) {
view_->InvalidateLine(selected_line_); view_->InvalidateLine(selected_line_);
if (state == BUTTON_FOCUSED) { if (state == BUTTON_FOCUSED) {
edit_model_->view()->SetAccessibilityLabel(edit_model_->view()->GetText(), edit_model_->SetAccessibilityLabel(match);
match);
view_->ProvideButtonFocusHint(selected_line_); view_->ProvideButtonFocusHint(selected_line_);
} }
} }
......
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