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/callback.h" | 10 #include "base/callback.h" |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 // is both a waste of time and a disclosure of potentially private, local | 820 // is both a waste of time and a disclosure of potentially private, local |
821 // data. Other "schemes" may actually be usernames, and we don't want to send | 821 // data. Other "schemes" may actually be usernames, and we don't want to send |
822 // passwords. If the scheme is OK, we still need to check other cases below. | 822 // passwords. If the scheme is OK, we still need to check other cases below. |
823 // If this is QUERY, then the presence of these schemes means the user | 823 // If this is QUERY, then the presence of these schemes means the user |
824 // explicitly typed one, and thus this is probably a URL that's being entered | 824 // explicitly typed one, and thus this is probably a URL that's being entered |
825 // and happens to currently be invalid -- in which case we again want to run | 825 // and happens to currently be invalid -- in which case we again want to run |
826 // our checks below. Other QUERY cases are less likely to be URLs and thus we | 826 // our checks below. Other QUERY cases are less likely to be URLs and thus we |
827 // assume we're OK. | 827 // assume we're OK. |
828 if (!LowerCaseEqualsASCII(input_.scheme(), content::kHttpScheme) && | 828 if (!LowerCaseEqualsASCII(input_.scheme(), content::kHttpScheme) && |
829 !LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && | 829 !LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && |
830 !LowerCaseEqualsASCII(input_.scheme(), chrome::kFtpScheme)) | 830 !LowerCaseEqualsASCII(input_.scheme(), content::kFtpScheme)) |
831 return (input_.type() == AutocompleteInput::QUERY); | 831 return (input_.type() == AutocompleteInput::QUERY); |
832 | 832 |
833 // Don't send URLs with usernames, queries or refs. Some of these are | 833 // Don't send URLs with usernames, queries or refs. Some of these are |
834 // private, and the Suggest server is unlikely to have any useful results | 834 // private, and the Suggest server is unlikely to have any useful results |
835 // for any of them. Also don't send URLs with ports, as we may initially | 835 // for any of them. Also don't send URLs with ports, as we may initially |
836 // think that a username + password is a host + port (and we don't want to | 836 // think that a username + password is a host + port (and we don't want to |
837 // send usernames/passwords), and even if the port really is a port, the | 837 // send usernames/passwords), and even if the port really is a port, the |
838 // server is once again unlikely to have and useful results. | 838 // server is once again unlikely to have and useful results. |
839 // Note that we only block based on refs if the input is URL-typed, as search | 839 // Note that we only block based on refs if the input is URL-typed, as search |
840 // queries can legitimately have #s in them which the URL parser | 840 // queries can legitimately have #s in them which the URL parser |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 it->set_relevance(max_query_relevance); | 1945 it->set_relevance(max_query_relevance); |
1946 it->set_relevance_from_server(relevance_from_server); | 1946 it->set_relevance_from_server(relevance_from_server); |
1947 } | 1947 } |
1948 } | 1948 } |
1949 | 1949 |
1950 void SearchProvider::UpdateDone() { | 1950 void SearchProvider::UpdateDone() { |
1951 // We're done when the timer isn't running, there are no suggest queries | 1951 // We're done when the timer isn't running, there are no suggest queries |
1952 // pending, and we're not waiting on Instant. | 1952 // pending, and we're not waiting on Instant. |
1953 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); | 1953 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); |
1954 } | 1954 } |
OLD | NEW |