OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } else { | 159 } else { |
160 // TODO(beng): ACMatchClassification::MATCH now seems to just mean | 160 // TODO(beng): ACMatchClassification::MATCH now seems to just mean |
161 // "bold" this. Consider modifying the terminology. | 161 // "bold" this. Consider modifying the terminology. |
162 // We don't iterate over the string here annotating all matches because | 162 // We don't iterate over the string here annotating all matches because |
163 // it looks odd to have every occurrence of a substring that may be as | 163 // it looks odd to have every occurrence of a substring that may be as |
164 // short as a single character highlighted in a query suggestion result, | 164 // short as a single character highlighted in a query suggestion result, |
165 // e.g. for input text "s" and query string "southwest airlines", it | 165 // e.g. for input text "s" and query string "southwest airlines", it |
166 // looks odd if both the first and last s are highlighted. | 166 // looks odd if both the first and last s are highlighted. |
167 if (input_position != 0) { | 167 if (input_position != 0) { |
168 match.contents_class.push_back( | 168 match.contents_class.push_back( |
169 ACMatchClassification(0, ACMatchClassification::NONE)); | 169 ACMatchClassification(0, ACMatchClassification::MATCH)); |
170 } | 170 } |
171 match.contents_class.push_back( | 171 match.contents_class.push_back( |
172 ACMatchClassification(input_position, ACMatchClassification::DIM)); | 172 ACMatchClassification(input_position, ACMatchClassification::NONE)); |
173 size_t next_fragment_position = input_position + input_text.length(); | 173 size_t next_fragment_position = input_position + input_text.length(); |
174 if (next_fragment_position < query_string.length()) { | 174 if (next_fragment_position < query_string.length()) { |
175 match.contents_class.push_back( | 175 match.contents_class.push_back( |
176 ACMatchClassification(next_fragment_position, | 176 ACMatchClassification(next_fragment_position, |
177 ACMatchClassification::NONE)); | 177 ACMatchClassification::MATCH)); |
178 } | 178 } |
179 } | 179 } |
180 } else { | 180 } else { |
181 // Otherwise, we're dealing with the "default search" result which has no | 181 // Otherwise, we're dealing with the "default search" result which has no |
182 // completion. | 182 // completion. |
183 match.contents_class.push_back( | 183 match.contents_class.push_back( |
184 ACMatchClassification(0, ACMatchClassification::NONE)); | 184 ACMatchClassification(0, ACMatchClassification::NONE)); |
185 } | 185 } |
186 | 186 |
187 // When the user forced a query, we need to make sure all the fill_into_edit | 187 // When the user forced a query, we need to make sure all the fill_into_edit |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 it->set_relevance(max_query_relevance); | 1602 it->set_relevance(max_query_relevance); |
1603 } | 1603 } |
1604 } | 1604 } |
1605 | 1605 |
1606 void SearchProvider::UpdateDone() { | 1606 void SearchProvider::UpdateDone() { |
1607 // We're done when the timer isn't running, there are no suggest queries | 1607 // We're done when the timer isn't running, there are no suggest queries |
1608 // pending, and we're not waiting on Instant. | 1608 // pending, and we're not waiting on Instant. |
1609 done_ = IsNonInstantSearchDone() && | 1609 done_ = IsNonInstantSearchDone() && |
1610 (instant_finalized_ || !chrome::IsInstantEnabled(profile_)); | 1610 (instant_finalized_ || !chrome::IsInstantEnabled(profile_)); |
1611 } | 1611 } |
OLD | NEW |