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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 bool SecurityPolicy::referrerPolicyFromHeaderValue( | 295 bool SecurityPolicy::referrerPolicyFromHeaderValue( |
296 const String& headerValue, | 296 const String& headerValue, |
297 ReferrerPolicyLegacyKeywordsSupport legacyKeywordsSupport, | 297 ReferrerPolicyLegacyKeywordsSupport legacyKeywordsSupport, |
298 ReferrerPolicy* result) { | 298 ReferrerPolicy* result) { |
299 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault; | 299 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault; |
300 | 300 |
301 Vector<String> tokens; | 301 Vector<String> tokens; |
302 headerValue.split(',', true, tokens); | 302 headerValue.split(',', true, tokens); |
303 for (const auto& token : tokens) { | 303 for (const auto& token : tokens) { |
304 ReferrerPolicy currentResult; | 304 ReferrerPolicy currentResult; |
305 if (SecurityPolicy::referrerPolicyFromString(token, legacyKeywordsSupport, | 305 if (SecurityPolicy::referrerPolicyFromString( |
306 ¤tResult)) { | 306 token.stripWhiteSpace(), legacyKeywordsSupport, ¤tResult)) { |
307 referrerPolicy = currentResult; | 307 referrerPolicy = currentResult; |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 if (referrerPolicy == ReferrerPolicyDefault) | 311 if (referrerPolicy == ReferrerPolicyDefault) |
312 return false; | 312 return false; |
313 | 313 |
314 *result = referrerPolicy; | 314 *result = referrerPolicy; |
315 return true; | 315 return true; |
316 } | 316 } |
317 | 317 |
318 } // namespace blink | 318 } // namespace blink |
OLD | NEW |