| 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/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return base::StartsWith(url.host_piece(), "www.google.", | 75 return base::StartsWith(url.host_piece(), "www.google.", |
| 76 base::CompareCase::SENSITIVE); | 76 base::CompareCase::SENSITIVE); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool IsGoogleSearchResultURL(const GURL& url) { | 79 bool IsGoogleSearchResultURL(const GURL& url) { |
| 80 if (!IsGoogleDomain(url)) | 80 if (!IsGoogleDomain(url)) |
| 81 return false; | 81 return false; |
| 82 return (url.path_piece().empty() || | 82 return (url.path_piece().empty() || |
| 83 base::StartsWith(url.path_piece(), "/search", | 83 base::StartsWith(url.path_piece(), "/search", |
| 84 base::CompareCase::SENSITIVE) || | 84 base::CompareCase::SENSITIVE) || |
| 85 (url.path() == "/") || | 85 (url.path_piece() == "/") || |
| 86 base::StartsWith(url.path_piece(), "/webhp", | 86 base::StartsWith(url.path_piece(), "/webhp", |
| 87 base::CompareCase::SENSITIVE)); | 87 base::CompareCase::SENSITIVE)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ReportPrerenderExternalURL() { | 90 void ReportPrerenderExternalURL() { |
| 91 ReportPrerenderSchemeCancelReason( | 91 ReportPrerenderSchemeCancelReason( |
| 92 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL); | 92 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void ReportUnsupportedPrerenderScheme(const GURL& url) { | 95 void ReportUnsupportedPrerenderScheme(const GURL& url) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 ReportPrerenderSchemeCancelReason( | 112 ReportPrerenderSchemeCancelReason( |
| 113 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION); | 113 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION); |
| 114 } else if (url.SchemeIs("about")) { | 114 } else if (url.SchemeIs("about")) { |
| 115 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT); | 115 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT); |
| 116 } else { | 116 } else { |
| 117 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN); | 117 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace prerender | 121 } // namespace prerender |
| OLD | NEW |