| 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 "components/omnibox/browser/scored_history_match.h" | 5 #include "components/omnibox/browser/scored_history_match.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Now that we're done processing this entry, correct the offsets of the | 325 // Now that we're done processing this entry, correct the offsets of the |
| 326 // matches in |url_matches| so they point to offsets in the original URL | 326 // matches in |url_matches| so they point to offsets in the original URL |
| 327 // spec, not the cleaned-up URL string that we used for matching. | 327 // spec, not the cleaned-up URL string that we used for matching. |
| 328 std::vector<size_t> offsets = OffsetsFromTermMatches(url_matches); | 328 std::vector<size_t> offsets = OffsetsFromTermMatches(url_matches); |
| 329 base::OffsetAdjuster::UnadjustOffsets(adjustments, &offsets); | 329 base::OffsetAdjuster::UnadjustOffsets(adjustments, &offsets); |
| 330 url_matches = ReplaceOffsetsInTermMatches(url_matches, offsets); | 330 url_matches = ReplaceOffsetsInTermMatches(url_matches, offsets); |
| 331 } | 331 } |
| 332 | 332 |
| 333 ScoredHistoryMatch::ScoredHistoryMatch(const ScoredHistoryMatch& other) = |
| 334 default; |
| 335 |
| 333 ScoredHistoryMatch::~ScoredHistoryMatch() { | 336 ScoredHistoryMatch::~ScoredHistoryMatch() { |
| 334 } | 337 } |
| 335 | 338 |
| 336 // Comparison function for sorting ScoredMatches by their scores with | 339 // Comparison function for sorting ScoredMatches by their scores with |
| 337 // intelligent tie-breaking. | 340 // intelligent tie-breaking. |
| 338 bool ScoredHistoryMatch::MatchScoreGreater(const ScoredHistoryMatch& m1, | 341 bool ScoredHistoryMatch::MatchScoreGreater(const ScoredHistoryMatch& m1, |
| 339 const ScoredHistoryMatch& m2) { | 342 const ScoredHistoryMatch& m2) { |
| 340 if (m1.raw_score != m2.raw_score) | 343 if (m1.raw_score != m2.raw_score) |
| 341 return m1.raw_score > m2.raw_score; | 344 return m1.raw_score > m2.raw_score; |
| 342 | 345 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 base::StringToDouble(it->first, &bucket.first); | 716 base::StringToDouble(it->first, &bucket.first); |
| 714 DCHECK(is_valid_intermediate_score); | 717 DCHECK(is_valid_intermediate_score); |
| 715 bool is_valid_hqp_score = base::StringToInt(it->second, &bucket.second); | 718 bool is_valid_hqp_score = base::StringToInt(it->second, &bucket.second); |
| 716 DCHECK(is_valid_hqp_score); | 719 DCHECK(is_valid_hqp_score); |
| 717 hqp_buckets->push_back(bucket); | 720 hqp_buckets->push_back(bucket); |
| 718 } | 721 } |
| 719 return true; | 722 return true; |
| 720 } | 723 } |
| 721 return false; | 724 return false; |
| 722 } | 725 } |
| OLD | NEW |