Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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() || | |
|
dominich
2011/08/30 23:43:33
nit: can the URL path be empty? I thought it was a
| |
| 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 |
| OLD | NEW |