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

Side by Side Diff: content/child/site_isolation_policy.cc

Issue 598453004: Replace some hard coded schemes with the constants in /url/url_constants.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address the comment. Created 6 years, 3 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
« no previous file with comments | « content/child/npapi/plugin_url_fetcher.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/child/site_isolation_policy.h" 5 #include "content/child/site_isolation_policy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return SiteIsolationResponseMetaData::XML; 326 return SiteIsolationResponseMetaData::XML;
327 } 327 }
328 328
329 return SiteIsolationResponseMetaData::Others; 329 return SiteIsolationResponseMetaData::Others;
330 } 330 }
331 331
332 bool SiteIsolationPolicy::IsBlockableScheme(const GURL& url) { 332 bool SiteIsolationPolicy::IsBlockableScheme(const GURL& url) {
333 // We exclude ftp:// from here. FTP doesn't provide a Content-Type 333 // We exclude ftp:// from here. FTP doesn't provide a Content-Type
334 // header which our policy depends on, so we cannot protect any 334 // header which our policy depends on, so we cannot protect any
335 // document from FTP servers. 335 // document from FTP servers.
336 return url.SchemeIs("http") || url.SchemeIs("https"); 336 return url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme);
337 } 337 }
338 338
339 bool SiteIsolationPolicy::IsSameSite(const GURL& frame_origin, 339 bool SiteIsolationPolicy::IsSameSite(const GURL& frame_origin,
340 const GURL& response_url) { 340 const GURL& response_url) {
341 341
342 if (!frame_origin.is_valid() || !response_url.is_valid()) 342 if (!frame_origin.is_valid() || !response_url.is_valid())
343 return false; 343 return false;
344 344
345 if (frame_origin.scheme() != response_url.scheme()) 345 if (frame_origin.scheme() != response_url.scheme())
346 return false; 346 return false;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // TODO(dsjang): This is a real hack. The only purpose of this function is to 504 // TODO(dsjang): This is a real hack. The only purpose of this function is to
505 // try to see if there's any possibility that this data can be JavaScript 505 // try to see if there's any possibility that this data can be JavaScript
506 // (superset of JS). This function will be removed once UMA stats are 506 // (superset of JS). This function will be removed once UMA stats are
507 // gathered. 507 // gathered.
508 508
509 // Search for "var " for JS detection. 509 // Search for "var " for JS detection.
510 return data.find("var ") != base::StringPiece::npos; 510 return data.find("var ") != base::StringPiece::npos;
511 } 511 }
512 512
513 } // namespace content 513 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/plugin_url_fetcher.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698