Index: chrome/browser/ui/app_list/search/common/webservice_search_provider.cc |
diff --git a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc |
index b651e5d13289f3e33594578a823ac38bc17f0875..f418495f87850d047fd35feb4f55ab56a1363b4c 100644 |
--- a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc |
+++ b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc |
@@ -8,6 +8,7 @@ |
#include "base/callback.h" |
#include "base/strings/string_util.h" |
+#include "chrome/browser/search/search.h" |
#include "chrome/common/url_constants.h" |
#include "url/gurl.h" |
@@ -16,10 +17,12 @@ namespace app_list { |
namespace { |
const int kWebserviceQueryThrottleIntrevalInMs = 100; |
+const size_t kMinimumQueryLength = 3u; |
} // namespace |
-WebserviceSearchProvider::WebserviceSearchProvider() : use_throttling_(true) {} |
+WebserviceSearchProvider::WebserviceSearchProvider(Profile* profile) |
+ : profile_(profile), use_throttling_(true) {} |
WebserviceSearchProvider::~WebserviceSearchProvider() {} |
@@ -36,6 +39,18 @@ void WebserviceSearchProvider::StartThrottledQuery( |
last_keytyped_ = base::Time::Now(); |
} |
+bool WebserviceSearchProvider::IsValidQuery(const string16& query) { |
+ // If |query| contains sensitive data, bail out and do not create the place |
+ // holder "search-web-store" result. |
+ if (IsSensitiveInput(query) || |
+ (query.size() < kMinimumQueryLength) || |
+ !chrome::IsSuggestPrefEnabled(profile_)) { |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
// Returns whether or not the user's input string, |query|, might contain any |
// sensitive information, based purely on its value and not where it came from. |
bool WebserviceSearchProvider::IsSensitiveInput(const string16& query) { |