OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_popup_model.h" | 5 #include "chrome/browser/autocomplete/autocomplete_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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 view_->OnDragCanceled(); | 127 view_->OnDragCanceled(); |
128 } | 128 } |
129 | 129 |
130 bool AutocompletePopupModel::GetKeywordForMatch(const AutocompleteMatch& match, | 130 bool AutocompletePopupModel::GetKeywordForMatch(const AutocompleteMatch& match, |
131 string16* keyword) const { | 131 string16* keyword) const { |
132 // Assume we have no keyword until we find otherwise. | 132 // Assume we have no keyword until we find otherwise. |
133 keyword->clear(); | 133 keyword->clear(); |
134 | 134 |
135 if (match.template_url && | 135 if (match.template_url && |
136 TemplateURL::SupportsReplacement(match.template_url) && | 136 TemplateURL::SupportsReplacement(match.template_url) && |
137 match.transition == PageTransition::KEYWORD) { | 137 match.transition == content::PAGE_TRANSITION_KEYWORD) { |
138 // The current match is a keyword, return that as the selected keyword. | 138 // The current match is a keyword, return that as the selected keyword. |
139 keyword->assign(match.template_url->keyword()); | 139 keyword->assign(match.template_url->keyword()); |
140 return false; | 140 return false; |
141 } | 141 } |
142 | 142 |
143 // See if the current match's fill_into_edit corresponds to a keyword. | 143 // See if the current match's fill_into_edit corresponds to a keyword. |
144 return GetKeywordForText(match.fill_into_edit, keyword); | 144 return GetKeywordForText(match.fill_into_edit, keyword); |
145 } | 145 } |
146 | 146 |
147 bool AutocompletePopupModel::GetKeywordForText(const string16& text, | 147 bool AutocompletePopupModel::GetKeywordForText(const string16& text, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 CHECK((selected_line_ != kNoMatch) || result.empty()); | 244 CHECK((selected_line_ != kNoMatch) || result.empty()); |
245 manually_selected_match_.Clear(); | 245 manually_selected_match_.Clear(); |
246 // If we're going to trim the window size to no longer include the hovered | 246 // If we're going to trim the window size to no longer include the hovered |
247 // line, turn hover off. Practically, this shouldn't happen, but it | 247 // line, turn hover off. Practically, this shouldn't happen, but it |
248 // doesn't hurt to be defensive. | 248 // doesn't hurt to be defensive. |
249 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) | 249 if ((hovered_line_ != kNoMatch) && (result.size() <= hovered_line_)) |
250 SetHoveredLine(kNoMatch); | 250 SetHoveredLine(kNoMatch); |
251 | 251 |
252 view_->UpdatePopupAppearance(); | 252 view_->UpdatePopupAppearance(); |
253 } | 253 } |
OLD | NEW |