Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| index e8754b5909bb2feddc4af1033649637bc021f4cb..5a3d760ce2866408d3a5f7f030f161259836ebc7 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| @@ -536,13 +536,17 @@ gfx::Size LocationBarView::GetPreferredSize() const { |
| return min_size; |
| } |
| +void LocationBarView::UpdatedKeywordHintVisibility() { |
|
Peter Kasting
2016/10/02 19:01:37
Nit: Update, not Updated
|
| + keyword_hint_view_->SetVisible(HasFocus()); |
| +} |
| + |
| void LocationBarView::Layout() { |
| if (!IsInitialized()) |
| return; |
| selected_keyword_view_->SetVisible(false); |
| location_icon_view_->SetVisible(false); |
| - keyword_hint_view_->SetVisible(false); |
| + // keyword_hint_view_->SetVisible(false); |
|
Peter Kasting
2016/10/02 19:01:37
This needs to call UpdateKeywordHintVisibility().
|
| const int item_padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING); |
| const int edge_thickness = GetHorizontalEdgeThickness(); |
| @@ -637,7 +641,8 @@ void LocationBarView::Layout() { |
| } |
| // Because IMEs may eat the tab key, we don't show "press tab to search" while |
| // IME composition is in progress. |
| - if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && |
| + if (keyword_hint_view_->visible() && !keyword.empty() && |
| + omnibox_view_->model()->is_keyword_hint() && |
| !omnibox_view_->IsImeComposing()) { |
|
Peter Kasting
2016/10/02 19:01:37
You need all this logic to go in UpdateKeywordHint
|
| trailing_decorations.AddDecoration(vertical_padding, location_height, true, |
| 0, item_padding, item_padding, |
| @@ -1224,6 +1229,11 @@ void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| void LocationBarView::OnFocus() { |
| omnibox_view_->SetFocus(); |
| + UpdatedKeywordHintVisibility(); |
| +} |
| + |
| +void LocationBarView::OnBlur() { |
| + UpdatedKeywordHintVisibility(); |
| } |
| void LocationBarView::OnPaint(gfx::Canvas* canvas) { |