| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 bool SecurityPolicy::IsUrlWhiteListedTrustworthy(const KURL& url) { | 173 bool SecurityPolicy::IsUrlWhiteListedTrustworthy(const KURL& url) { |
| 174 // Early return to avoid initializing the SecurityOrigin. | 174 // Early return to avoid initializing the SecurityOrigin. |
| 175 if (TrustworthyOriginSet().IsEmpty()) | 175 if (TrustworthyOriginSet().IsEmpty()) |
| 176 return false; | 176 return false; |
| 177 return IsOriginWhiteListedTrustworthy(*SecurityOrigin::Create(url).Get()); | 177 return IsOriginWhiteListedTrustworthy(*SecurityOrigin::Create(url).Get()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool SecurityPolicy::IsAccessWhiteListed(const SecurityOrigin* active_origin, | 180 bool SecurityPolicy::IsAccessWhiteListed(const SecurityOrigin* active_origin, |
| 181 const SecurityOrigin* target_origin) { | 181 const SecurityOrigin* target_origin) { |
| 182 if (OriginAccessWhiteList* list = | 182 const OriginAccessMap& map = GetOriginAccessMap(); |
| 183 GetOriginAccessMap().at(active_origin->ToString())) { | 183 if (map.IsEmpty()) |
| 184 return false; |
| 185 if (OriginAccessWhiteList* list = map.at(active_origin->ToString())) { |
| 184 for (size_t i = 0; i < list->size(); ++i) { | 186 for (size_t i = 0; i < list->size(); ++i) { |
| 185 if (list->at(i).MatchesOrigin(*target_origin) != | 187 if (list->at(i).MatchesOrigin(*target_origin) != |
| 186 OriginAccessEntry::kDoesNotMatchOrigin) | 188 OriginAccessEntry::kDoesNotMatchOrigin) |
| 187 return true; | 189 return true; |
| 188 } | 190 } |
| 189 } | 191 } |
| 190 return false; | 192 return false; |
| 191 } | 193 } |
| 192 | 194 |
| 193 bool SecurityPolicy::IsAccessToURLWhiteListed( | 195 bool SecurityPolicy::IsAccessToURLWhiteListed( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 312 } |
| 311 | 313 |
| 312 if (referrer_policy == kReferrerPolicyDefault) | 314 if (referrer_policy == kReferrerPolicyDefault) |
| 313 return false; | 315 return false; |
| 314 | 316 |
| 315 *result = referrer_policy; | 317 *result = referrer_policy; |
| 316 return true; | 318 return true; |
| 317 } | 319 } |
| 318 | 320 |
| 319 } // namespace blink | 321 } // namespace blink |
| OLD | NEW |