| Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| index f4c00643fe23d73adee5ea7d4e4f7071a42908bf..d0f1835e5a4d3e44d475281749be8205d0cae45f 100644
|
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| @@ -58,12 +58,16 @@ namespace {
|
|
|
| // Stores omnibox state for each tab.
|
| struct ViewState {
|
| - explicit ViewState(const gfx::SelectionModel& selection_model)
|
| - : selection_model(selection_model) {
|
| + explicit ViewState(const gfx::SelectionModel& selection_model,
|
| + bool is_focus_visible)
|
| + : selection_model(selection_model),
|
| + is_focus_visible(is_focus_visible) {
|
| }
|
|
|
| // SelectionModel of selected text.
|
| gfx::SelectionModel selection_model;
|
| + // Is the focus visible?
|
| + bool is_focus_visible;
|
| };
|
|
|
| const char kAutocompleteEditStateKey[] = "AutocompleteEditState";
|
| @@ -440,7 +444,7 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// OmniboxViewViews, AutocopmleteEditView implementation:
|
| +// OmniboxViewViews, AutocompleteEditView implementation:
|
|
|
| void OmniboxViewViews::SaveStateToTab(WebContents* tab) {
|
| DCHECK(tab);
|
| @@ -459,7 +463,8 @@ void OmniboxViewViews::SaveStateToTab(WebContents* tab) {
|
| textfield_->GetSelectionModel(&selection);
|
| tab->SetUserData(
|
| kAutocompleteEditStateKey,
|
| - new AutocompleteEditState(model_state, ViewState(selection)));
|
| + new AutocompleteEditState(
|
| + model_state, ViewState(selection, model()->is_focus_visible())));
|
| }
|
|
|
| void OmniboxViewViews::Update(const WebContents* contents) {
|
| @@ -480,6 +485,7 @@ void OmniboxViewViews::Update(const WebContents* contents) {
|
| contents->GetUserData(&kAutocompleteEditStateKey));
|
| if (state) {
|
| model()->RestoreState(state->model_state);
|
| + SetFocusVisibility(state->view_state.is_focus_visible);
|
|
|
| // Move the marks for the cursor and the other end of the selection to
|
| // the previously-saved offsets (but preserve PRIMARY).
|
| @@ -569,6 +575,13 @@ void OmniboxViewViews::UpdatePopup() {
|
| }
|
|
|
| void OmniboxViewViews::SetFocus() {
|
| + SetFocusVisibility(true);
|
| + // In views-implementation, the focus is on textfield rather than OmniboxView.
|
| + textfield_->RequestFocus();
|
| +}
|
| +
|
| +void OmniboxViewViews::SetInvisibleFocus() {
|
| + SetFocusVisibility(false);
|
| // In views-implementation, the focus is on textfield rather than OmniboxView.
|
| textfield_->RequestFocus();
|
| }
|
| @@ -599,6 +612,7 @@ void OmniboxViewViews::OnRevertTemporaryText() {
|
| }
|
|
|
| void OmniboxViewViews::OnBeforePossibleChange() {
|
| + SetFocusVisibility(true);
|
| // Record our state.
|
| text_before_change_ = GetText();
|
| textfield_->GetSelectedRange(&sel_before_change_);
|
| @@ -936,3 +950,9 @@ void OmniboxViewViews::OnPaste() {
|
| textfield_->ReplaceSelection(text);
|
| }
|
| }
|
| +
|
| +void OmniboxViewViews::SetFocusVisibility(bool is_focus_visible) {
|
| + DVLOG(1) << "SetFocusVisibility(" << is_focus_visible << ");";
|
| + model()->OnFocusVisibilityChange(is_focus_visible);
|
| + // TODO(mathp): actually make focus invisible
|
| +}
|
|
|