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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 1220963005: Update base::StartsWith calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } kEligibleMasks[] = { 166 } kEligibleMasks[] = {
167 // All text/ types are eligible, even if not displayable. 167 // All text/ types are eligible, even if not displayable.
168 { "text/", NULL }, 168 { "text/", NULL },
169 // JSON (application/json and application/*+json) is eligible. 169 // JSON (application/json and application/*+json) is eligible.
170 { "application/", "json" }, 170 { "application/", "json" },
171 // Javascript is eligible. 171 // Javascript is eligible.
172 { "application/", "javascript" }, 172 { "application/", "javascript" },
173 // XML (application/xml and application/*+xml) is eligible. 173 // XML (application/xml and application/*+xml) is eligible.
174 { "application/", "xml" }, 174 { "application/", "xml" },
175 }; 175 };
176 const bool kCaseSensitive = true;
177 176
178 std::string mime_type; 177 std::string mime_type;
179 request->GetMimeType(&mime_type); 178 request->GetMimeType(&mime_type);
180 179
181 for (size_t i = 0; i < arraysize(kEligibleMasks); i++) { 180 for (size_t i = 0; i < arraysize(kEligibleMasks); i++) {
182 const char *prefix = kEligibleMasks[i].prefix; 181 const char *prefix = kEligibleMasks[i].prefix;
183 const char *suffix = kEligibleMasks[i].suffix; 182 const char *suffix = kEligibleMasks[i].suffix;
184 if (prefix && !base::StartsWithASCII(mime_type, prefix, kCaseSensitive)) 183 if (prefix &&
184 !base::StartsWith(mime_type, prefix, base::CompareCase::SENSITIVE))
185 continue; 185 continue;
186 if (suffix && !base::EndsWith(mime_type, suffix, kCaseSensitive)) 186 if (suffix &&
187 !base::EndsWith(mime_type, suffix, base::CompareCase::SENSITIVE))
187 continue; 188 continue;
188 return true; 189 return true;
189 } 190 }
190 return false; 191 return false;
191 } 192 }
192 193
193 // Returns whether |request| was issued by a renderer process, as opposed to 194 // Returns whether |request| was issued by a renderer process, as opposed to
194 // the browser process or a plugin process. 195 // the browser process or a plugin process.
195 bool IsRendererInitiatedRequest(const net::URLRequest* request) { 196 bool IsRendererInitiatedRequest(const net::URLRequest* request) {
196 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 197 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return experimental_web_platform_features_enabled_; 683 return experimental_web_platform_features_enabled_;
683 } 684 }
684 685
685 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( 686 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
686 const net::URLRequest& request, 687 const net::URLRequest& request,
687 const GURL& target_url, 688 const GURL& target_url,
688 const GURL& referrer_url) const { 689 const GURL& referrer_url) const {
689 ReportInvalidReferrerSend(target_url, referrer_url); 690 ReportInvalidReferrerSend(target_url, referrer_url);
690 return true; 691 return true;
691 } 692 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698