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