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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 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 (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.h" 8 #include "base/metrics/histogram.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (!new_url.is_empty() && new_url.is_valid()) { 65 if (!new_url.is_empty() && new_url.is_valid()) {
66 *alias_url = new_url; 66 *alias_url = new_url;
67 return true; 67 return true;
68 } 68 }
69 return false; 69 return false;
70 } 70 }
71 return false; 71 return false;
72 } 72 }
73 73
74 bool IsGoogleDomain(const GURL& url) { 74 bool IsGoogleDomain(const GURL& url) {
75 return StartsWithASCII(url.host(), std::string("www.google."), true); 75 return base::StartsWithASCII(url.host(), std::string("www.google."), true);
76 } 76 }
77 77
78 bool IsGoogleSearchResultURL(const GURL& url) { 78 bool IsGoogleSearchResultURL(const GURL& url) {
79 if (!IsGoogleDomain(url)) 79 if (!IsGoogleDomain(url))
80 return false; 80 return false;
81 return (url.path().empty() || 81 return (url.path().empty() ||
82 StartsWithASCII(url.path(), std::string("/search"), true) || 82 base::StartsWithASCII(url.path(), std::string("/search"), true) ||
83 (url.path() == "/") || 83 (url.path() == "/") ||
84 StartsWithASCII(url.path(), std::string("/webhp"), true)); 84 base::StartsWithASCII(url.path(), std::string("/webhp"), true));
85 } 85 }
86 86
87 void ReportPrerenderExternalURL() { 87 void ReportPrerenderExternalURL() {
88 ReportPrerenderSchemeCancelReason( 88 ReportPrerenderSchemeCancelReason(
89 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL); 89 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL);
90 } 90 }
91 91
92 void ReportUnsupportedPrerenderScheme(const GURL& url) { 92 void ReportUnsupportedPrerenderScheme(const GURL& url) {
93 if (url.SchemeIs("data")) { 93 if (url.SchemeIs("data")) {
94 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_DATA); 94 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_DATA);
(...skipping 14 matching lines...) Expand all
109 ReportPrerenderSchemeCancelReason( 109 ReportPrerenderSchemeCancelReason(
110 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION); 110 PRERENDER_SCHEME_CANCEL_REASON_CHROME_EXTENSION);
111 } else if (url.SchemeIs("about")) { 111 } else if (url.SchemeIs("about")) {
112 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT); 112 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_ABOUT);
113 } else { 113 } else {
114 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN); 114 ReportPrerenderSchemeCancelReason(PRERENDER_SCHEME_CANCEL_REASON_UNKNOWN);
115 } 115 }
116 } 116 }
117 117
118 } // namespace prerender 118 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prefs/tracked/pref_hash_browsertest.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698