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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 // is both a waste of time and a disclosure of potentially private, local | 553 // is both a waste of time and a disclosure of potentially private, local |
554 // data. Other "schemes" may actually be usernames, and we don't want to send | 554 // data. Other "schemes" may actually be usernames, and we don't want to send |
555 // passwords. If the scheme is OK, we still need to check other cases below. | 555 // passwords. If the scheme is OK, we still need to check other cases below. |
556 // If this is QUERY, then the presence of these schemes means the user | 556 // If this is QUERY, then the presence of these schemes means the user |
557 // explicitly typed one, and thus this is probably a URL that's being entered | 557 // explicitly typed one, and thus this is probably a URL that's being entered |
558 // and happens to currently be invalid -- in which case we again want to run | 558 // and happens to currently be invalid -- in which case we again want to run |
559 // our checks below. Other QUERY cases are less likely to be URLs and thus we | 559 // our checks below. Other QUERY cases are less likely to be URLs and thus we |
560 // assume we're OK. | 560 // assume we're OK. |
561 if (!LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && | 561 if (!LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && |
562 !LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && | 562 !LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && |
563 !LowerCaseEqualsASCII(input_.scheme(), content::kFtpScheme)) | 563 !LowerCaseEqualsASCII(input_.scheme(), url::kFtpScheme)) |
564 return (input_.type() == AutocompleteInput::QUERY); | 564 return (input_.type() == AutocompleteInput::QUERY); |
565 | 565 |
566 // Don't send URLs with usernames, queries or refs. Some of these are | 566 // Don't send URLs with usernames, queries or refs. Some of these are |
567 // private, and the Suggest server is unlikely to have any useful results | 567 // private, and the Suggest server is unlikely to have any useful results |
568 // for any of them. Also don't send URLs with ports, as we may initially | 568 // for any of them. Also don't send URLs with ports, as we may initially |
569 // think that a username + password is a host + port (and we don't want to | 569 // think that a username + password is a host + port (and we don't want to |
570 // send usernames/passwords), and even if the port really is a port, the | 570 // send usernames/passwords), and even if the port really is a port, the |
571 // server is once again unlikely to have and useful results. | 571 // server is once again unlikely to have and useful results. |
572 // Note that we only block based on refs if the input is URL-typed, as search | 572 // Note that we only block based on refs if the input is URL-typed, as search |
573 // queries can legitimately have #s in them which the URL parser | 573 // queries can legitimately have #s in them which the URL parser |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 match.RecordAdditionalInfo(kShouldPrefetchKey, kFalse); | 1124 match.RecordAdditionalInfo(kShouldPrefetchKey, kFalse); |
1125 | 1125 |
1126 return match; | 1126 return match; |
1127 } | 1127 } |
1128 | 1128 |
1129 void SearchProvider::UpdateDone() { | 1129 void SearchProvider::UpdateDone() { |
1130 // We're done when the timer isn't running, there are no suggest queries | 1130 // We're done when the timer isn't running, there are no suggest queries |
1131 // pending, and we're not waiting on Instant. | 1131 // pending, and we're not waiting on Instant. |
1132 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); | 1132 done_ = !timer_.IsRunning() && (suggest_results_pending_ == 0); |
1133 } | 1133 } |
OLD | NEW |