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 "core/inspector/InspectedFrames.h" | 5 #include "core/inspector/InspectedFrames.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 InspectedFrames::InspectedFrames(LocalFrame* root) : root_(root) {} | 12 InspectedFrames::InspectedFrames(LocalFrame* root) : root_(root) {} |
13 | 13 |
14 InspectedFrames::Iterator InspectedFrames::begin() { | 14 InspectedFrames::Iterator InspectedFrames::begin() { |
15 return Iterator(root_, root_); | 15 return Iterator(root_, root_); |
16 } | 16 } |
17 | 17 |
18 InspectedFrames::Iterator InspectedFrames::end() { | 18 InspectedFrames::Iterator InspectedFrames::end() { |
19 return Iterator(root_, nullptr); | 19 return Iterator(root_, nullptr); |
20 } | 20 } |
21 | 21 |
22 bool InspectedFrames::Contains(LocalFrame* frame) const { | 22 bool InspectedFrames::Contains(LocalFrame* frame) const { |
23 return frame->InstrumentingAgents() == root_->InstrumentingAgents(); | 23 return frame->InstrumentingAgents() == root_->InstrumentingAgents(); |
24 } | 24 } |
25 | 25 |
26 bool InspectedFrames::Contains(ExecutionContext* context) const { | |
27 return context->GetProbeSink() == root_->InstrumentingAgents(); | |
dgozman
2017/05/15 16:39:55
This code looks strange as is. I would not expect
kinuko
2017/05/15 20:09:34
Actually this is the important bit I want to discu
| |
28 } | |
29 | |
26 LocalFrame* InspectedFrames::FrameWithSecurityOrigin( | 30 LocalFrame* InspectedFrames::FrameWithSecurityOrigin( |
27 const String& origin_raw_string) { | 31 const String& origin_raw_string) { |
28 for (LocalFrame* frame : *this) { | 32 for (LocalFrame* frame : *this) { |
29 if (frame->GetDocument()->GetSecurityOrigin()->ToRawString() == | 33 if (frame->GetDocument()->GetSecurityOrigin()->ToRawString() == |
30 origin_raw_string) | 34 origin_raw_string) |
31 return frame; | 35 return frame; |
32 } | 36 } |
33 return nullptr; | 37 return nullptr; |
34 } | 38 } |
35 | 39 |
(...skipping 29 matching lines...) Expand all Loading... | |
65 | 69 |
66 bool InspectedFrames::Iterator::operator!=(const Iterator& other) { | 70 bool InspectedFrames::Iterator::operator!=(const Iterator& other) { |
67 return !(*this == other); | 71 return !(*this == other); |
68 } | 72 } |
69 | 73 |
70 DEFINE_TRACE(InspectedFrames) { | 74 DEFINE_TRACE(InspectedFrames) { |
71 visitor->Trace(root_); | 75 visitor->Trace(root_); |
72 } | 76 } |
73 | 77 |
74 } // namespace blink | 78 } // namespace blink |
OLD | NEW |