OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2011 Google Inc. All Rights Reserved. | |
2 // Author: supersat@google.com (Karl Koscher) | |
Charlie Reis
2011/12/01 23:13:02
Nit: wrong template.
supersat
2011/12/09 23:08:20
Done.
| |
3 | |
4 #include "browsing_instance_frame_id.h" | |
5 | |
6 namespace content { | |
7 | |
8 BrowsingInstanceFrame::WebKitFrameIdTuple::WebKitFrameIdTuple(int proc_host_id, | |
9 int64 frame_id) | |
10 : process_host_id(proc_host_id), | |
11 frame_id(frame_id) { | |
12 } | |
13 | |
14 bool BrowsingInstanceFrame::WebKitFrameIdTuple::operator==( | |
15 const WebKitFrameIdTuple& o) const { | |
16 return o.process_host_id == process_host_id && | |
17 o.frame_id == frame_id; | |
18 } | |
19 | |
20 BrowsingInstanceFrame::BrowsingInstanceFrame(int64 id, bool is_top_level) | |
21 : id_(id), | |
22 current_webkit_frame_(WebKitFrameIdTuple(-1, -1)), | |
23 current_route_id_(-1), | |
24 is_top_level_(is_top_level) { | |
25 } | |
26 | |
27 BrowsingInstanceFrame::~BrowsingInstanceFrame() { | |
28 } | |
29 | |
30 void BrowsingInstanceFrame::UpdateFrame(int new_process_host_id, | |
31 int new_route_id, | |
32 int64 new_frame_id) { | |
33 current_webkit_frame_.process_host_id = new_process_host_id; | |
34 current_webkit_frame_.frame_id = new_frame_id; | |
35 current_route_id_ = new_route_id; | |
36 // TODO(supersat): Clear out subframes? | |
37 } | |
38 | |
39 BrowsingInstanceFrame* BrowsingInstanceFrame::FindById(int64 id) { | |
40 if (id == id_) | |
41 return this; | |
42 | |
43 std::list<BrowsingInstanceFrame *>::iterator iter; | |
44 for (iter = children_.begin(); iter != children_.end(); iter++) { | |
45 BrowsingInstanceFrame *retValue = (*iter)->FindById(id); | |
46 if (retValue) { | |
47 return retValue; | |
48 } | |
49 } | |
50 | |
51 return 0; | |
52 } | |
53 | |
54 } // namespace content | |
OLD | NEW |