OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 10 #include "base/callback.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 // autocompleting this term, so we don't need to worry about confusion as | 624 // autocompleting this term, so we don't need to worry about confusion as |
625 // much. This also prevents calling Classify() again from inside the | 625 // much. This also prevents calling Classify() again from inside the |
626 // classifier (which will corrupt state and likely crash), since the | 626 // classifier (which will corrupt state and likely crash), since the |
627 // classifier always disabled inline autocomplete. | 627 // classifier always disabled inline autocomplete. |
628 // * When the user has typed the whole term, the "what you typed" history | 628 // * When the user has typed the whole term, the "what you typed" history |
629 // match will outrank us for URL-like inputs anyway, so we need not do | 629 // match will outrank us for URL-like inputs anyway, so we need not do |
630 // anything special. | 630 // anything special. |
631 if (!input_.prevent_inline_autocomplete() && classifier && | 631 if (!input_.prevent_inline_autocomplete() && classifier && |
632 i->term != input_.text()) { | 632 i->term != input_.text()) { |
633 AutocompleteMatch match; | 633 AutocompleteMatch match; |
634 classifier->Classify(i->term, string16(), false, &match, NULL); | 634 classifier->Classify(i->term, string16(), false, false, &match, NULL); |
635 term_looks_like_url = match.transition == PageTransition::TYPED; | 635 term_looks_like_url = match.transition == PageTransition::TYPED; |
636 } | 636 } |
637 int relevance = CalculateRelevanceForHistory(i->time, term_looks_like_url, | 637 int relevance = CalculateRelevanceForHistory(i->time, term_looks_like_url, |
638 is_keyword); | 638 is_keyword); |
639 if (i != results.begin() && relevance >= last_relevance) | 639 if (i != results.begin() && relevance >= last_relevance) |
640 relevance = last_relevance - 1; | 640 relevance = last_relevance - 1; |
641 last_relevance = relevance; | 641 last_relevance = relevance; |
642 AddMatchToMap(i->term, | 642 AddMatchToMap(i->term, |
643 is_keyword ? keyword_input_text_ : input_.text(), | 643 is_keyword ? keyword_input_text_ : input_.text(), |
644 relevance, | 644 relevance, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 match.description_class.push_back( | 905 match.description_class.push_back( |
906 ACMatchClassification(0, ACMatchClassification::DIM)); | 906 ACMatchClassification(0, ACMatchClassification::DIM)); |
907 // Only the first search match gets a description. | 907 // Only the first search match gets a description. |
908 return; | 908 return; |
909 | 909 |
910 default: | 910 default: |
911 break; | 911 break; |
912 } | 912 } |
913 } | 913 } |
914 } | 914 } |
OLD | NEW |