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

Side by Side Diff: chrome/browser/prerender/prerender_util.cc

Issue 7812011: Tighten conditions for when a URL is a search result, and move (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prerender/prerender_util.h" 5 #include "chrome/browser/prerender/prerender_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h"
8 #include "googleurl/src/url_canon.h" 9 #include "googleurl/src/url_canon.h"
9 #include "googleurl/src/url_parse.h" 10 #include "googleurl/src/url_parse.h"
10 #include "googleurl/src/url_util.h" 11 #include "googleurl/src/url_util.h"
11 12
12 namespace prerender { 13 namespace prerender {
13 14
14 bool MaybeGetQueryStringBasedAliasURL( 15 bool MaybeGetQueryStringBasedAliasURL(
15 const GURL& url, GURL* alias_url) { 16 const GURL& url, GURL* alias_url) {
16 DCHECK(alias_url); 17 DCHECK(alias_url);
17 url_parse::Parsed parsed; 18 url_parse::Parsed parsed;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (value.len != 1) 55 if (value.len != 1)
55 continue; 56 continue;
56 uint8 exp = *(url.spec().c_str() + value.begin) - '0'; 57 uint8 exp = *(url.spec().c_str() + value.begin) - '0';
57 if (exp < 1 || exp > 9) 58 if (exp < 1 || exp > 9)
58 continue; 59 continue;
59 return exp; 60 return exp;
60 } 61 }
61 return kNoExperiment; 62 return kNoExperiment;
62 } 63 }
63 64
65 bool IsGoogleSearchResultURL(const GURL& url) {
66 if (!StartsWithASCII(url.host(), std::string("www.google."), true))
67 return false;
68 return (url.path().empty() ||
69 StartsWithASCII(url.path(), std::string("/search"), true) ||
70 (url.path() == "/") ||
71 StartsWithASCII(url.path(), std::string("/webhp"), true));
72 }
73
64 } // namespace prerender 74 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_util.h ('k') | chrome/browser/prerender/prerender_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698