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

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

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 years, 6 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 unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search/search.h" 12 #include "chrome/browser/search/search.h"
13 #include "chrome/browser/ui/app_list/search/common/webservice_cache.h" 13 #include "chrome/browser/ui/app_list/search/common/webservice_cache.h"
14 #include "chrome/browser/ui/app_list/search/common/webservice_cache_factory.h" 14 #include "chrome/browser/ui/app_list/search/common/webservice_cache_factory.h"
15 #include "chrome/common/url_constants.h"
16 #include "url/gurl.h" 15 #include "url/gurl.h"
16 #include "url/url_constants.h"
17 17
18 namespace app_list { 18 namespace app_list {
19 19
20 namespace { 20 namespace {
21 21
22 const int kWebserviceQueryThrottleIntrevalInMs = 100; 22 const int kWebserviceQueryThrottleIntrevalInMs = 100;
23 const size_t kMinimumQueryLength = 3u; 23 const size_t kMinimumQueryLength = 3u;
24 24
25 } // namespace 25 } // namespace
26 26
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return false; 64 return false;
65 65
66 // The input can be interpreted as a URL. Check to see if it is potentially 66 // The input can be interpreted as a URL. Check to see if it is potentially
67 // sensitive. (Code shamelessly copied from search_provider.cc's 67 // sensitive. (Code shamelessly copied from search_provider.cc's
68 // IsQuerySuitableForSuggest function.) 68 // IsQuerySuitableForSuggest function.)
69 69
70 // First we check the scheme: if this looks like a URL with a scheme that is 70 // First we check the scheme: if this looks like a URL with a scheme that is
71 // file, we shouldn't send it. Sending such things is a waste of time and a 71 // file, we shouldn't send it. Sending such things is a waste of time and a
72 // disclosure of potentially private, local data. If the scheme is OK, we 72 // disclosure of potentially private, local data. If the scheme is OK, we
73 // still need to check other cases below. 73 // still need to check other cases below.
74 if (LowerCaseEqualsASCII(query_as_url.scheme(), content::kFileScheme)) 74 if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kFileScheme))
75 return true; 75 return true;
76 76
77 // Don't send URLs with usernames, queries or refs. Some of these are 77 // Don't send URLs with usernames, queries or refs. Some of these are
78 // private, and the Suggest server is unlikely to have any useful results 78 // private, and the Suggest server is unlikely to have any useful results
79 // for any of them. Also don't send URLs with ports, as we may initially 79 // for any of them. Also don't send URLs with ports, as we may initially
80 // think that a username + password is a host + port (and we don't want to 80 // think that a username + password is a host + port (and we don't want to
81 // send usernames/passwords), and even if the port really is a port, the 81 // send usernames/passwords), and even if the port really is a port, the
82 // server is once again unlikely to have and useful results. 82 // server is once again unlikely to have and useful results.
83 if (!query_as_url.username().empty() || 83 if (!query_as_url.username().empty() ||
84 !query_as_url.port().empty() || 84 !query_as_url.port().empty() ||
85 !query_as_url.query().empty() || 85 !query_as_url.query().empty() ||
86 !query_as_url.ref().empty()) { 86 !query_as_url.ref().empty()) {
87 return true; 87 return true;
88 } 88 }
89 89
90 // Don't send anything for https except the hostname. Hostnames are OK 90 // Don't send anything for https except the hostname. Hostnames are OK
91 // because they are visible when the TCP connection is established, but the 91 // because they are visible when the TCP connection is established, but the
92 // specific path may reveal private information. 92 // specific path may reveal private information.
93 if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && 93 if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) &&
94 !query_as_url.path().empty() && query_as_url.path() != "/") { 94 !query_as_url.path().empty() && query_as_url.path() != "/") {
95 return true; 95 return true;
96 } 96 }
97 97
98 return false; 98 return false;
99 } 99 }
100 100
101 } // namespace app_list 101 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_service_unittest.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698