OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "core/frame/csp/SourceListDirective.h" | 5 #include "core/frame/csp/SourceListDirective.h" |
6 | 6 |
7 #include "core/frame/csp/CSPSource.h" | 7 #include "core/frame/csp/CSPSource.h" |
8 #include "core/frame/csp/ContentSecurityPolicy.h" | 8 #include "core/frame/csp/ContentSecurityPolicy.h" |
9 #include "platform/network/ContentSecurityPolicyParsers.h" | 9 #include "platform/network/ContentSecurityPolicyParsers.h" |
10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 const KURL& url, | 562 const KURL& url, |
563 ResourceRequest::RedirectStatus redirectStatus) const { | 563 ResourceRequest::RedirectStatus redirectStatus) const { |
564 for (size_t i = 0; i < m_list.size(); ++i) { | 564 for (size_t i = 0; i < m_list.size(); ++i) { |
565 if (m_list[i]->matches(url, redirectStatus)) | 565 if (m_list[i]->matches(url, redirectStatus)) |
566 return true; | 566 return true; |
567 } | 567 } |
568 | 568 |
569 return false; | 569 return false; |
570 } | 570 } |
571 | 571 |
| 572 HeapVector<Member<CSPSource>> SourceListDirective::getIntersectCSPSources( |
| 573 HeapVector<Member<CSPSource>> otherVector) { |
| 574 HeapVector<Member<CSPSource>> normalized; |
| 575 for (const auto& aCspSource : m_list) { |
| 576 Member<CSPSource> matchedCspSource(nullptr); |
| 577 for (const auto& bCspSource : otherVector) { |
| 578 if ((matchedCspSource = bCspSource->intersect(aCspSource))) |
| 579 break; |
| 580 } |
| 581 if (matchedCspSource) |
| 582 normalized.append(matchedCspSource); |
| 583 } |
| 584 return normalized; |
| 585 } |
| 586 |
572 DEFINE_TRACE(SourceListDirective) { | 587 DEFINE_TRACE(SourceListDirective) { |
573 visitor->trace(m_policy); | 588 visitor->trace(m_policy); |
574 visitor->trace(m_list); | 589 visitor->trace(m_list); |
575 CSPDirective::trace(visitor); | 590 CSPDirective::trace(visitor); |
576 } | 591 } |
577 | 592 |
578 } // namespace blink | 593 } // namespace blink |
OLD | NEW |