OLD | NEW |
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/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/callback.h" | 10 #include "base/callback.h" |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 int relevance, | 1092 int relevance, |
1093 AutocompleteMatch::Type type, | 1093 AutocompleteMatch::Type type, |
1094 int accepted_suggestion, | 1094 int accepted_suggestion, |
1095 bool is_keyword, | 1095 bool is_keyword, |
1096 MatchMap* map) { | 1096 MatchMap* map) { |
1097 AutocompleteMatch match(this, relevance, false, type); | 1097 AutocompleteMatch match(this, relevance, false, type); |
1098 std::vector<size_t> content_param_offsets; | 1098 std::vector<size_t> content_param_offsets; |
1099 // Bail out now if we don't actually have a valid provider. | 1099 // Bail out now if we don't actually have a valid provider. |
1100 match.keyword = is_keyword ? | 1100 match.keyword = is_keyword ? |
1101 providers_.keyword_provider() : providers_.default_provider(); | 1101 providers_.keyword_provider() : providers_.default_provider(); |
1102 const TemplateURL* provider_url = match.GetTemplateURL(profile_); | 1102 const TemplateURL* provider_url = match.GetTemplateURL(profile_, false); |
1103 if (provider_url == NULL) | 1103 if (provider_url == NULL) |
1104 return; | 1104 return; |
1105 | 1105 |
1106 match.contents.assign(query_string); | 1106 match.contents.assign(query_string); |
1107 // We do intra-string highlighting for suggestions - the suggested segment | 1107 // We do intra-string highlighting for suggestions - the suggested segment |
1108 // will be highlighted, e.g. for input_text = "you" the suggestion may be | 1108 // will be highlighted, e.g. for input_text = "you" the suggestion may be |
1109 // "youtube", so we'll bold the "tube" section: you*tube*. | 1109 // "youtube", so we'll bold the "tube" section: you*tube*. |
1110 if (input_text != query_string) { | 1110 if (input_text != query_string) { |
1111 size_t input_position = match.contents.find(input_text); | 1111 size_t input_position = match.contents.find(input_text); |
1112 if (input_position == string16::npos) { | 1112 if (input_position == string16::npos) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 return match; | 1253 return match; |
1254 } | 1254 } |
1255 | 1255 |
1256 void SearchProvider::UpdateDone() { | 1256 void SearchProvider::UpdateDone() { |
1257 // We're done when the timer isn't running, there are no suggest queries | 1257 // We're done when the timer isn't running, there are no suggest queries |
1258 // pending, and we're not waiting on instant. | 1258 // pending, and we're not waiting on instant. |
1259 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && | 1259 done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) && |
1260 (instant_finalized_ || | 1260 (instant_finalized_ || |
1261 !InstantController::IsInstantEnabled(profile_))); | 1261 !InstantController::IsInstantEnabled(profile_))); |
1262 } | 1262 } |
OLD | NEW |