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/autocomplete_result.h" | 5 #include "chrome/browser/autocomplete/autocomplete_result.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // score of 0. | 187 // score of 0. |
188 size_t num_matches; | 188 size_t num_matches; |
189 for (num_matches = 0u; (num_matches < max_num_matches) && | 189 for (num_matches = 0u; (num_matches < max_num_matches) && |
190 (comparing_object.GetDemotedRelevance(*match_at(num_matches)) > 0); | 190 (comparing_object.GetDemotedRelevance(*match_at(num_matches)) > 0); |
191 ++num_matches) {} | 191 ++num_matches) {} |
192 matches_.resize(num_matches); | 192 matches_.resize(num_matches); |
193 | 193 |
194 default_match_ = matches_.begin(); | 194 default_match_ = matches_.begin(); |
195 | 195 |
196 if (default_match_ != matches_.end()) { | 196 if (default_match_ != matches_.end()) { |
197 const string16 debug_info = ASCIIToUTF16("fill_into_edit=") + | 197 const base::string16 debug_info = ASCIIToUTF16("fill_into_edit=") + |
198 default_match_->fill_into_edit + ASCIIToUTF16(", provider=") + | 198 default_match_->fill_into_edit + ASCIIToUTF16(", provider=") + |
199 ((default_match_->provider != NULL) ? | 199 ((default_match_->provider != NULL) ? |
200 ASCIIToUTF16(default_match_->provider->GetName()) : string16()) + | 200 ASCIIToUTF16(default_match_->provider->GetName()) : base::string16()) + |
201 ASCIIToUTF16(", input=") + input.text(); | 201 ASCIIToUTF16(", input=") + input.text(); |
202 DCHECK(default_match_->allowed_to_be_default_match) << debug_info; | 202 DCHECK(default_match_->allowed_to_be_default_match) << debug_info; |
203 // We shouldn't get query matches for URL inputs, or non-query matches | 203 // We shouldn't get query matches for URL inputs, or non-query matches |
204 // for query inputs. | 204 // for query inputs. |
205 if (AutocompleteMatch::IsSearchType(default_match_->type)) { | 205 if (AutocompleteMatch::IsSearchType(default_match_->type)) { |
206 DCHECK_NE(AutocompleteInput::URL, input.type()) << debug_info; | 206 DCHECK_NE(AutocompleteInput::URL, input.type()) << debug_info; |
207 } else { | 207 } else { |
208 DCHECK_NE(AutocompleteInput::FORCED_QUERY, input.type()) << debug_info; | 208 DCHECK_NE(AutocompleteInput::FORCED_QUERY, input.type()) << debug_info; |
209 } | 209 } |
210 } | 210 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 i != old_matches.rend() && delta > 0; ++i) { | 376 i != old_matches.rend() && delta > 0; ++i) { |
377 if (!HasMatchByDestination(*i, new_matches)) { | 377 if (!HasMatchByDestination(*i, new_matches)) { |
378 AutocompleteMatch match = *i; | 378 AutocompleteMatch match = *i; |
379 match.relevance = std::min(max_relevance, match.relevance); | 379 match.relevance = std::min(max_relevance, match.relevance); |
380 match.from_previous = true; | 380 match.from_previous = true; |
381 AddMatch(page_classification, match); | 381 AddMatch(page_classification, match); |
382 delta--; | 382 delta--; |
383 } | 383 } |
384 } | 384 } |
385 } | 385 } |
OLD | NEW |