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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // Next we check the scheme. If this is UNKNOWN/URL with a scheme that isn't | 738 // Next we check the scheme. If this is UNKNOWN/URL with a scheme that isn't |
739 // http/https/ftp, we shouldn't send it. Sending things like file: and data: | 739 // http/https/ftp, we shouldn't send it. Sending things like file: and data: |
740 // is both a waste of time and a disclosure of potentially private, local | 740 // is both a waste of time and a disclosure of potentially private, local |
741 // data. Other "schemes" may actually be usernames, and we don't want to send | 741 // data. Other "schemes" may actually be usernames, and we don't want to send |
742 // passwords. If the scheme is OK, we still need to check other cases below. | 742 // passwords. If the scheme is OK, we still need to check other cases below. |
743 // If this is QUERY, then the presence of these schemes means the user | 743 // If this is QUERY, then the presence of these schemes means the user |
744 // explicitly typed one, and thus this is probably a URL that's being entered | 744 // explicitly typed one, and thus this is probably a URL that's being entered |
745 // and happens to currently be invalid -- in which case we again want to run | 745 // and happens to currently be invalid -- in which case we again want to run |
746 // our checks below. Other QUERY cases are less likely to be URLs and thus we | 746 // our checks below. Other QUERY cases are less likely to be URLs and thus we |
747 // assume we're OK. | 747 // assume we're OK. |
748 if (!LowerCaseEqualsASCII(input_.scheme(), chrome::kHttpScheme) && | 748 if (!LowerCaseEqualsASCII(input_.scheme(), content::kHttpScheme) && |
749 !LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && | 749 !LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && |
750 !LowerCaseEqualsASCII(input_.scheme(), chrome::kFtpScheme)) | 750 !LowerCaseEqualsASCII(input_.scheme(), chrome::kFtpScheme)) |
751 return (input_.type() == AutocompleteInput::QUERY); | 751 return (input_.type() == AutocompleteInput::QUERY); |
752 | 752 |
753 // Don't send URLs with usernames, queries or refs. Some of these are | 753 // Don't send URLs with usernames, queries or refs. Some of these are |
754 // private, and the Suggest server is unlikely to have any useful results | 754 // private, and the Suggest server is unlikely to have any useful results |
755 // for any of them. Also don't send URLs with ports, as we may initially | 755 // for any of them. Also don't send URLs with ports, as we may initially |
756 // think that a username + password is a host + port (and we don't want to | 756 // think that a username + password is a host + port (and we don't want to |
757 // send usernames/passwords), and even if the port really is a port, the | 757 // send usernames/passwords), and even if the port really is a port, the |
758 // server is once again unlikely to have and useful results. | 758 // server is once again unlikely to have and useful results. |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 it->set_relevance(max_query_relevance); | 1617 it->set_relevance(max_query_relevance); |
1618 it->set_relevance_from_server(relevance_from_server); | 1618 it->set_relevance_from_server(relevance_from_server); |
1619 } | 1619 } |
1620 } | 1620 } |
1621 | 1621 |
1622 void SearchProvider::UpdateDone() { | 1622 void SearchProvider::UpdateDone() { |
1623 // We're done when the timer isn't running, there are no suggest queries | 1623 // We're done when the timer isn't running, there are no suggest queries |
1624 // pending, and we're not waiting on Instant. | 1624 // pending, and we're not waiting on Instant. |
1625 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); | 1625 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); |
1626 } | 1626 } |
OLD | NEW |