OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |