| 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 94a93c12ce9687e8fb8519dc54b6f1b606317b60..ac3b7dc57d785e6e5bb43e76a4dab10da97690fd 100644
|
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| @@ -224,7 +224,8 @@ OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller,
|
| delete_at_end_pressed_(false),
|
| location_bar_view_(location_bar),
|
| ime_candidate_window_open_(false),
|
| - select_all_on_mouse_release_(false) {
|
| + select_all_on_mouse_release_(false),
|
| + visible_caret_color_(SK_ColorBLACK) {
|
| }
|
|
|
| OmniboxViewViews::~OmniboxViewViews() {
|
| @@ -406,6 +407,7 @@ void OmniboxViewViews::HandleFocusOut() {
|
| // Close the popup.
|
| CloseOmniboxPopup();
|
| // Tell the model to reset itself.
|
| + model()->SetCaretVisibility(true);
|
| model()->OnKillFocus();
|
| controller()->OnKillFocus();
|
| }
|
| @@ -445,7 +447,7 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// OmniboxViewViews, AutocopmleteEditView implementation:
|
| +// OmniboxViewViews, OmniboxView implementation:
|
|
|
| void OmniboxViewViews::SaveStateToTab(WebContents* tab) {
|
| DCHECK(tab);
|
| @@ -574,10 +576,20 @@ void OmniboxViewViews::UpdatePopup() {
|
| }
|
|
|
| void OmniboxViewViews::SetFocus() {
|
| + model()->SetCaretVisibility(true);
|
| // In views-implementation, the focus is on textfield rather than OmniboxView.
|
| textfield_->RequestFocus();
|
| }
|
|
|
| +void OmniboxViewViews::ApplyCaretVisibility() {
|
| + if (textfield_->cursor_color() != textfield_->background_color())
|
| + visible_caret_color_ = textfield_->cursor_color();
|
| + // Setting the color of the text cursor (caret) to the background color
|
| + // effectively hides it.
|
| + textfield_->SetCursorColor(model()->is_caret_visible() ?
|
| + visible_caret_color_ : textfield_->background_color());
|
| +}
|
| +
|
| void OmniboxViewViews::OnTemporaryTextMaybeChanged(
|
| const string16& display_text,
|
| bool save_original_selection) {
|
| @@ -604,6 +616,10 @@ void OmniboxViewViews::OnRevertTemporaryText() {
|
| }
|
|
|
| void OmniboxViewViews::OnBeforePossibleChange() {
|
| + // We set the focus to visible here to cover two cases. This is called when
|
| + // the user directly clicks on the omnibox as well as when a character is
|
| + // about to be entered.
|
| + model()->SetCaretVisibility(true);
|
| // Record our state.
|
| text_before_change_ = GetText();
|
| textfield_->GetSelectedRange(&sel_before_change_);
|
|
|