Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: Source/web/OpenedFrameTracker.cpp

Issue 271793002: Implement WebFrame::swap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/OpenedFrameTracker.h ('k') | Source/web/WebFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "web/OpenedFrameTracker.h" 6 #include "web/OpenedFrameTracker.h"
7 7
8 #include "public/web/WebFrame.h" 8 #include "public/web/WebFrame.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 OpenedFrameTracker::OpenedFrameTracker() 12 OpenedFrameTracker::OpenedFrameTracker()
13 { 13 {
14 } 14 }
15 15
16 OpenedFrameTracker::~OpenedFrameTracker() 16 OpenedFrameTracker::~OpenedFrameTracker()
17 { 17 {
18 HashSet<WebFrame*>::iterator end = m_openedFrames.end(); 18 updateOpener(0);
19 for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++ it) 19 }
20 (*it)->m_opener = 0; 20
21 bool OpenedFrameTracker::isEmpty() const
22 {
23 return m_openedFrames.isEmpty();
21 } 24 }
22 25
23 void OpenedFrameTracker::add(WebFrame* frame) 26 void OpenedFrameTracker::add(WebFrame* frame)
24 { 27 {
25 m_openedFrames.add(frame); 28 m_openedFrames.add(frame);
26 } 29 }
27 30
28 void OpenedFrameTracker::remove(WebFrame* frame) 31 void OpenedFrameTracker::remove(WebFrame* frame)
29 { 32 {
30 m_openedFrames.remove(frame); 33 m_openedFrames.remove(frame);
31 } 34 }
32 35
36 void OpenedFrameTracker::updateOpener(WebFrame* frame)
37 {
38 HashSet<WebFrame*>::iterator end = m_openedFrames.end();
39 for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++ it)
40 (*it)->m_opener = frame;
41 }
42
33 } // namespace blink 43 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/OpenedFrameTracker.h ('k') | Source/web/WebFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698