Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6681)

Unified Diff: chrome/browser/ui/app_list/search/common/webservice_search_provider.cc

Issue 23874015: Implement people search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698