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/search_provider.h" | 5 #include "components/omnibox/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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 // Finally, if we have an inlineable navsuggestion with an inline completion | 1431 // Finally, if we have an inlineable navsuggestion with an inline completion |
1432 // that we're not preventing, make sure we didn't trim any whitespace. | 1432 // that we're not preventing, make sure we didn't trim any whitespace. |
1433 // We don't want to claim http://foo.com/bar is inlineable against the | 1433 // We don't want to claim http://foo.com/bar is inlineable against the |
1434 // input "foo.com/b ". | 1434 // input "foo.com/b ". |
1435 match.allowed_to_be_default_match = | 1435 match.allowed_to_be_default_match = |
1436 (prefix != NULL) && | 1436 (prefix != NULL) && |
1437 (providers_.GetKeywordProviderURL() == NULL) && | 1437 (providers_.GetKeywordProviderURL() == NULL) && |
1438 !navigation.received_after_last_keystroke() && | 1438 !navigation.received_after_last_keystroke() && |
1439 (match.inline_autocompletion.empty() || | 1439 (match.inline_autocompletion.empty() || |
1440 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace)); | 1440 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace)); |
1441 match.EnsureUWYTIsAllowedToBeDefault(input_.canonicalized_url(), | 1441 match.EnsureUWYTIsAllowedToBeDefault(input_, |
1442 client()->GetTemplateURLService()); | 1442 client()->GetTemplateURLService()); |
1443 | 1443 |
1444 match.contents = navigation.match_contents(); | 1444 match.contents = navigation.match_contents(); |
1445 match.contents_class = navigation.match_contents_class(); | 1445 match.contents_class = navigation.match_contents_class(); |
1446 match.description = navigation.description(); | 1446 match.description = navigation.description(); |
1447 AutocompleteMatch::ClassifyMatchInString(input, match.description, | 1447 AutocompleteMatch::ClassifyMatchInString(input, match.description, |
1448 ACMatchClassification::NONE, &match.description_class); | 1448 ACMatchClassification::NONE, &match.description_class); |
1449 | 1449 |
1450 match.RecordAdditionalInfo( | 1450 match.RecordAdditionalInfo( |
1451 kRelevanceFromServerKey, | 1451 kRelevanceFromServerKey, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) | 1514 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) |
1515 matches.push_back(i->second); | 1515 matches.push_back(i->second); |
1516 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); | 1516 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); |
1517 | 1517 |
1518 // If there is a top scoring entry, find the corresponding answer. | 1518 // If there is a top scoring entry, find the corresponding answer. |
1519 if (!matches.empty()) | 1519 if (!matches.empty()) |
1520 return answers_cache_.GetTopAnswerEntry(matches[0].contents); | 1520 return answers_cache_.GetTopAnswerEntry(matches[0].contents); |
1521 | 1521 |
1522 return AnswersQueryData(); | 1522 return AnswersQueryData(); |
1523 } | 1523 } |
OLD | NEW |