| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/search/common/webservice_search_provider.h" | 5 #include "chrome/browser/ui/app_list/search/common/webservice_search_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 start_query.Run(); | 40 start_query.Run(); |
| 41 } else { | 41 } else { |
| 42 query_throttler_.Start(FROM_HERE, interval, start_query); | 42 query_throttler_.Start(FROM_HERE, interval, start_query); |
| 43 } | 43 } |
| 44 last_keytyped_ = base::Time::Now(); | 44 last_keytyped_ = base::Time::Now(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool WebserviceSearchProvider::IsValidQuery(const base::string16& query) { | 47 bool WebserviceSearchProvider::IsValidQuery(const base::string16& query) { |
| 48 // If |query| contains sensitive data, bail out and do not create the place | 48 // If |query| contains sensitive data, bail out and do not create the place |
| 49 // holder "search-web-store" result. | 49 // holder "search-web-store" result. |
| 50 if (IsSensitiveInput(query) || | 50 if (IsSensitiveInput(query) || (query.size() < kMinimumQueryLength) || |
| 51 (query.size() < kMinimumQueryLength) || | 51 !search::IsSuggestPrefEnabled(profile_)) { |
| 52 !chrome::IsSuggestPrefEnabled(profile_)) { | |
| 53 return false; | 52 return false; |
| 54 } | 53 } |
| 55 | 54 |
| 56 return true; | 55 return true; |
| 57 } | 56 } |
| 58 | 57 |
| 59 // Returns whether or not the user's input string, |query|, might contain any | 58 // Returns whether or not the user's input string, |query|, might contain any |
| 60 // sensitive information, based purely on its value and not where it came from. | 59 // sensitive information, based purely on its value and not where it came from. |
| 61 bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { | 60 bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { |
| 62 const GURL query_as_url(query); | 61 const GURL query_as_url(query); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 92 // specific path may reveal private information. | 91 // specific path may reveal private information. |
| 93 if (base::LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && | 92 if (base::LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && |
| 94 !query_as_url.path().empty() && query_as_url.path() != "/") { | 93 !query_as_url.path().empty() && query_as_url.path() != "/") { |
| 95 return true; | 94 return true; |
| 96 } | 95 } |
| 97 | 96 |
| 98 return false; | 97 return false; |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace app_list | 100 } // namespace app_list |
| OLD | NEW |