OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/cross_site_document_classifier.h" | 5 #include "content/common/cross_site_document_classifier.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 bool CrossSiteDocumentClassifier::IsBlockableScheme(const GURL& url) { | 78 bool CrossSiteDocumentClassifier::IsBlockableScheme(const GURL& url) { |
79 // We exclude ftp:// from here. FTP doesn't provide a Content-Type | 79 // We exclude ftp:// from here. FTP doesn't provide a Content-Type |
80 // header which our policy depends on, so we cannot protect any | 80 // header which our policy depends on, so we cannot protect any |
81 // document from FTP servers. | 81 // document from FTP servers. |
82 return url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme); | 82 return url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme); |
83 } | 83 } |
84 | 84 |
85 bool CrossSiteDocumentClassifier::IsSameSite(const url::Origin& frame_origin, | 85 bool CrossSiteDocumentClassifier::IsSameSite(const url::Origin& frame_origin, |
86 const GURL& response_url) { | 86 const GURL& response_url) { |
87 if (frame_origin.unique() || !response_url.is_valid()) | 87 if (frame_origin.opaque() || !response_url.is_valid()) |
88 return false; | 88 return false; |
89 | 89 |
90 if (frame_origin.scheme() != response_url.scheme()) | 90 if (frame_origin.scheme() != response_url.scheme()) |
91 return false; | 91 return false; |
92 | 92 |
93 // SameDomainOrHost() extracts the effective domains (public suffix plus one) | 93 // SameDomainOrHost() extracts the effective domains (public suffix plus one) |
94 // from the two URLs and compare them. | 94 // from the two URLs and compare them. |
95 return net::registry_controlled_domains::SameDomainOrHost( | 95 return net::registry_controlled_domains::SameDomainOrHost( |
96 response_url, frame_origin, | 96 response_url, frame_origin, |
97 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 97 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 case kColonState: | 238 case kColonState: |
239 case kTerminalState: | 239 case kTerminalState: |
240 NOTREACHED(); | 240 NOTREACHED(); |
241 break; | 241 break; |
242 } | 242 } |
243 } | 243 } |
244 return state == kColonState; | 244 return state == kColonState; |
245 } | 245 } |
246 | 246 |
247 } // namespace content | 247 } // namespace content |
OLD | NEW |