| 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/history/scored_history_match.h" | 5 #include "chrome/browser/history/scored_history_match.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <numeric> | 10 #include <numeric> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 Init(); | 62 Init(); |
| 63 | 63 |
| 64 GURL gurl = row.url(); | 64 GURL gurl = row.url(); |
| 65 if (!gurl.is_valid()) | 65 if (!gurl.is_valid()) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 // Figure out where each search term appears in the URL and/or page title | 68 // Figure out where each search term appears in the URL and/or page title |
| 69 // so that we can score as well as provide autocomplete highlighting. | 69 // so that we can score as well as provide autocomplete highlighting. |
| 70 base::OffsetAdjuster::Adjustments adjustments; | 70 base::OffsetAdjuster::Adjustments adjustments; |
| 71 base::string16 url = | 71 base::string16 url = |
| 72 bookmark_utils::CleanUpUrlForMatching(gurl, languages, &adjustments); | 72 bookmarks::CleanUpUrlForMatching(gurl, languages, &adjustments); |
| 73 base::string16 title = bookmark_utils::CleanUpTitleForMatching(row.title()); | 73 base::string16 title = bookmarks::CleanUpTitleForMatching(row.title()); |
| 74 int term_num = 0; | 74 int term_num = 0; |
| 75 for (String16Vector::const_iterator iter = terms.begin(); iter != terms.end(); | 75 for (String16Vector::const_iterator iter = terms.begin(); iter != terms.end(); |
| 76 ++iter, ++term_num) { | 76 ++iter, ++term_num) { |
| 77 base::string16 term = *iter; | 77 base::string16 term = *iter; |
| 78 TermMatches url_term_matches = MatchTermInString(term, url, term_num); | 78 TermMatches url_term_matches = MatchTermInString(term, url, term_num); |
| 79 TermMatches title_term_matches = MatchTermInString(term, title, term_num); | 79 TermMatches title_term_matches = MatchTermInString(term, title, term_num); |
| 80 if (url_term_matches.empty() && title_term_matches.empty()) | 80 if (url_term_matches.empty() && title_term_matches.empty()) |
| 81 return; // A term was not found in either URL or title - reject. | 81 return; // A term was not found in either URL or title - reject. |
| 82 url_matches_.insert(url_matches_.end(), url_term_matches.begin(), | 82 url_matches_.insert(url_matches_.end(), url_term_matches.begin(), |
| 83 url_term_matches.end()); | 83 url_term_matches.end()); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 max_assigned_score_for_non_inlineable_matches_ = | 599 max_assigned_score_for_non_inlineable_matches_ = |
| 600 HistoryURLProvider::kScoreForBestInlineableResult - 1; | 600 HistoryURLProvider::kScoreForBestInlineableResult - 1; |
| 601 } | 601 } |
| 602 bookmark_value_ = OmniboxFieldTrial::HQPBookmarkValue(); | 602 bookmark_value_ = OmniboxFieldTrial::HQPBookmarkValue(); |
| 603 allow_tld_matches_ = OmniboxFieldTrial::HQPAllowMatchInTLDValue(); | 603 allow_tld_matches_ = OmniboxFieldTrial::HQPAllowMatchInTLDValue(); |
| 604 allow_scheme_matches_ = OmniboxFieldTrial::HQPAllowMatchInSchemeValue(); | 604 allow_scheme_matches_ = OmniboxFieldTrial::HQPAllowMatchInSchemeValue(); |
| 605 initialized_ = true; | 605 initialized_ = true; |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace history | 608 } // namespace history |
| OLD | NEW |