| 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 "components/omnibox/browser/search_provider.h" | 5 #include "components/omnibox/browser/search_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // KeywordProvider::CalculateRelevance() scores all other types of | 168 // KeywordProvider::CalculateRelevance() scores all other types of |
| 169 // keyword verbatim matches. | 169 // keyword verbatim matches. |
| 170 if (allow_exact_keyword_match && prefer_keyword) | 170 if (allow_exact_keyword_match && prefer_keyword) |
| 171 return 1500; | 171 return 1500; |
| 172 return (allow_exact_keyword_match && | 172 return (allow_exact_keyword_match && |
| 173 (type == metrics::OmniboxInputType::QUERY)) ? | 173 (type == metrics::OmniboxInputType::QUERY)) ? |
| 174 1450 : 1100; | 174 1450 : 1100; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void SearchProvider::ResetSession() { | 177 void SearchProvider::ResetSession() { |
| 178 set_field_trial_triggered(false); |
| 178 set_field_trial_triggered_in_session(false); | 179 set_field_trial_triggered_in_session(false); |
| 179 } | 180 } |
| 180 | 181 |
| 181 SearchProvider::~SearchProvider() { | 182 SearchProvider::~SearchProvider() { |
| 182 TemplateURLService* template_url_service = client()->GetTemplateURLService(); | 183 TemplateURLService* template_url_service = client()->GetTemplateURLService(); |
| 183 if (template_url_service) | 184 if (template_url_service) |
| 184 template_url_service->RemoveObserver(this); | 185 template_url_service->RemoveObserver(this); |
| 185 } | 186 } |
| 186 | 187 |
| 187 // static | 188 // static |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) | 1509 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) |
| 1509 matches.push_back(i->second); | 1510 matches.push_back(i->second); |
| 1510 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); | 1511 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); |
| 1511 | 1512 |
| 1512 // If there is a top scoring entry, find the corresponding answer. | 1513 // If there is a top scoring entry, find the corresponding answer. |
| 1513 if (!matches.empty()) | 1514 if (!matches.empty()) |
| 1514 return answers_cache_.GetTopAnswerEntry(matches[0].contents); | 1515 return answers_cache_.GetTopAnswerEntry(matches[0].contents); |
| 1515 | 1516 |
| 1516 return AnswersQueryData(); | 1517 return AnswersQueryData(); |
| 1517 } | 1518 } |
| OLD | NEW |