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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_popup_model.cc

Issue 11198074: Initial implementation of dedupping search provider's URLs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add a missing include. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.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 "chrome/browser/ui/omnibox/omnibox_popup_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "unicode/ubidi.h" 9 #include "unicode/ubidi.h"
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // before notifying us, reducing flicker. At that point the check for 189 // before notifying us, reducing flicker. At that point the check for
190 // deletability can move there too. 190 // deletability can move there too.
191 SetSelectedLine(selected_line, false, true); 191 SetSelectedLine(selected_line, false, true);
192 } 192 }
193 } 193 }
194 } 194 }
195 195
196 gfx::Image OmniboxPopupModel::GetIconIfExtensionMatch( 196 gfx::Image OmniboxPopupModel::GetIconIfExtensionMatch(
197 const AutocompleteMatch& match) const { 197 const AutocompleteMatch& match) const {
198 Profile* profile = edit_model_->profile(); 198 Profile* profile = edit_model_->profile();
199 const TemplateURL* template_url = match.GetTemplateURL(profile); 199 const TemplateURL* template_url = match.GetTemplateURL(profile, false);
200 if (template_url && template_url->IsExtensionKeyword()) { 200 if (template_url && template_url->IsExtensionKeyword()) {
201 return profile->GetExtensionService()->GetOmniboxPopupIcon( 201 return profile->GetExtensionService()->GetOmniboxPopupIcon(
202 template_url->GetExtensionId()); 202 template_url->GetExtensionId());
203 } 203 }
204 return gfx::Image(); 204 return gfx::Image();
205 } 205 }
206 206
207 void OmniboxPopupModel::OnResultChanged() { 207 void OmniboxPopupModel::OnResultChanged() {
208 const AutocompleteResult& result = this->result(); 208 const AutocompleteResult& result = this->result();
209 selected_line_ = result.default_match() == result.end() ? 209 selected_line_ = result.default_match() == result.end() ?
210 kNoMatch : static_cast<size_t>(result.default_match() - result.begin()); 210 kNoMatch : static_cast<size_t>(result.default_match() - result.begin());
211 // There had better not be a nonempty result set with no default match. 211 // There had better not be a nonempty result set with no default match.
212 CHECK((selected_line_ != kNoMatch) || result.empty()); 212 CHECK((selected_line_ != kNoMatch) || result.empty());
213 manually_selected_match_.Clear(); 213 manually_selected_match_.Clear();
214 selected_line_state_ = NORMAL; 214 selected_line_state_ = NORMAL;
215 // If we're going to trim the window size to no longer include the hovered 215 // If we're going to trim the window size to no longer include the hovered
216 // line, turn hover off. Practically, this shouldn't happen, but it 216 // line, turn hover off. Practically, this shouldn't happen, but it
217 // doesn't hurt to be defensive. 217 // doesn't hurt to be defensive.
218 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) 218 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_))
219 SetHoveredLine(kNoMatch); 219 SetHoveredLine(kNoMatch);
220 220
221 view_->UpdatePopupAppearance(); 221 view_->UpdatePopupAppearance();
222 } 222 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698