Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: components/omnibox/browser/omnibox_popup_model.cc

Issue 2070733002: Update omnibox dropdown selection/hover background drawing for MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scaled_radius
Patch Set: Use BackgroundWith1PxBorder to do the drawing Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/browser/omnibox_popup_model.h" 5 #include "components/omnibox/browser/omnibox_popup_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return view_->IsOpen(); 104 return view_->IsOpen();
105 } 105 }
106 106
107 void OmniboxPopupModel::SetHoveredLine(size_t line) { 107 void OmniboxPopupModel::SetHoveredLine(size_t line) {
108 const bool is_disabling = (line == kNoMatch); 108 const bool is_disabling = (line == kNoMatch);
109 DCHECK(is_disabling || (line < result().size())); 109 DCHECK(is_disabling || (line < result().size()));
110 110
111 if (line == hovered_line_) 111 if (line == hovered_line_)
112 return; // Nothing to do 112 return; // Nothing to do
113 113
114 // We need to update |hovered_line_| before calling InvalidateLine(), since it
115 // will check it to determine how to draw.
116 const size_t prev_hovered_line = hovered_line_;
117 hovered_line_ = line;
118
114 // Make sure the old hovered line is redrawn. No need to redraw the selected 119 // Make sure the old hovered line is redrawn. No need to redraw the selected
115 // line since selection overrides hover so the appearance won't change. 120 // line since selection overrides hover so the appearance won't change.
116 if ((hovered_line_ != kNoMatch) && (hovered_line_ != selected_line_)) 121 if ((prev_hovered_line != kNoMatch) && (prev_hovered_line != selected_line_))
117 view_->InvalidateLine(hovered_line_); 122 view_->InvalidateLine(prev_hovered_line);
118 123
119 // Change the hover to the new line.
120 hovered_line_ = line;
121 if (!is_disabling && (hovered_line_ != selected_line_)) 124 if (!is_disabling && (hovered_line_ != selected_line_))
122 view_->InvalidateLine(hovered_line_); 125 view_->InvalidateLine(hovered_line_);
123 } 126 }
124 127
125 void OmniboxPopupModel::SetSelectedLine(size_t line, 128 void OmniboxPopupModel::SetSelectedLine(size_t line,
126 bool reset_to_default, 129 bool reset_to_default,
127 bool force) { 130 bool force) {
128 const AutocompleteResult& result = this->result(); 131 const AutocompleteResult& result = this->result();
129 if (result.empty()) 132 if (result.empty())
130 return; 133 return;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 294 }
292 295
293 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) { 296 void OmniboxPopupModel::RemoveObserver(OmniboxPopupModelObserver* observer) {
294 observers_.RemoveObserver(observer); 297 observers_.RemoveObserver(observer);
295 } 298 }
296 299
297 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) { 300 void OmniboxPopupModel::SetAnswerBitmap(const SkBitmap& bitmap) {
298 answer_bitmap_ = bitmap; 301 answer_bitmap_ = bitmap;
299 view_->UpdatePopupAppearance(); 302 view_->UpdatePopupAppearance();
300 } 303 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698