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..f7375b7c938158f0e607b872f57e06f0ad9c492c 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() { |
@@ -445,7 +446,7 @@ void OmniboxViewViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// OmniboxViewViews, AutocopmleteEditView implementation: |
+// OmniboxViewViews, OmniboxView implementation: |
void OmniboxViewViews::SaveStateToTab(WebContents* tab) { |
DCHECK(tab); |
@@ -574,10 +575,21 @@ void OmniboxViewViews::UpdatePopup() { |
} |
void OmniboxViewViews::SetFocus() { |
+ model()->SetFocusVisibility(true); |
// In views-implementation, the focus is on textfield rather than OmniboxView. |
textfield_->RequestFocus(); |
} |
+void OmniboxViewViews::ApplyFocusVisibility() { |
+ if (textfield_->cursor_color() != textfield_->background_color()) { |
Peter Kasting
2012/12/04 02:00:52
Nit: No {}
samarth
2012/12/04 04:55:35
Done.
|
+ 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_focus_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 |
Peter Kasting
2012/12/04 02:00:52
Really, this is called when the user clicks on the
samarth
2012/12/04 04:55:35
It comes through OnBeforeUserAction() which is tri
Peter Kasting
2012/12/04 22:23:32
That's odd.
|
+ // about to be entered. |
+ model()->SetFocusVisibility(true); |
// Record our state. |
text_before_change_ = GetText(); |
textfield_->GetSelectedRange(&sel_before_change_); |