| 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/base64.h" | 10 #include "base/base64.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const std::string languages( | 156 const std::string languages( |
| 157 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 157 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
| 158 for (NavigationResults::iterator nav_it = results->navigation_results.begin(); | 158 for (NavigationResults::iterator nav_it = results->navigation_results.begin(); |
| 159 nav_it != results->navigation_results.end(); ++nav_it) { | 159 nav_it != results->navigation_results.end(); ++nav_it) { |
| 160 nav_it->CalculateAndClassifyMatchContents(false, input_text, languages); | 160 nav_it->CalculateAndClassifyMatchContents(false, input_text, languages); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 // static | 164 // static |
| 165 int SearchProvider::CalculateRelevanceForKeywordVerbatim( | 165 int SearchProvider::CalculateRelevanceForKeywordVerbatim( |
| 166 AutocompleteInput::Type type, | 166 metrics::OmniboxInputType::Type type, |
| 167 bool prefer_keyword) { | 167 bool prefer_keyword) { |
| 168 // This function is responsible for scoring verbatim query matches | 168 // This function is responsible for scoring verbatim query matches |
| 169 // for non-extension keywords. KeywordProvider::CalculateRelevance() | 169 // for non-extension keywords. KeywordProvider::CalculateRelevance() |
| 170 // scores verbatim query matches for extension keywords, as well as | 170 // scores verbatim query matches for extension keywords, as well as |
| 171 // for keyword matches (i.e., suggestions of a keyword itself, not a | 171 // for keyword matches (i.e., suggestions of a keyword itself, not a |
| 172 // suggestion of a query on a keyword search engine). These two | 172 // suggestion of a query on a keyword search engine). These two |
| 173 // functions are currently in sync, but there's no reason we | 173 // functions are currently in sync, but there's no reason we |
| 174 // couldn't decide in the future to score verbatim matches | 174 // couldn't decide in the future to score verbatim matches |
| 175 // differently for extension and non-extension keywords. If you | 175 // differently for extension and non-extension keywords. If you |
| 176 // make such a change, however, you should update this comment to | 176 // make such a change, however, you should update this comment to |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 // Make the base64 encoded value URL and filename safe(see RFC 3548). | 1162 // Make the base64 encoded value URL and filename safe(see RFC 3548). |
| 1163 std::replace(current_token_.begin(), current_token_.end(), '+', '-'); | 1163 std::replace(current_token_.begin(), current_token_.end(), '+', '-'); |
| 1164 std::replace(current_token_.begin(), current_token_.end(), '/', '_'); | 1164 std::replace(current_token_.begin(), current_token_.end(), '/', '_'); |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 // Extend expiration time another 60 seconds. | 1167 // Extend expiration time another 60 seconds. |
| 1168 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60); | 1168 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60); |
| 1169 | 1169 |
| 1170 return current_token_; | 1170 return current_token_; |
| 1171 } | 1171 } |
| OLD | NEW |