Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / OpenedFrameTracker.h
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
3 // found in the LICENSE file.
4
5 #ifndef OpenedFrameTracker_h
6 #define OpenedFrameTracker_h
7
8 #include "wtf/HashSet.h"
9 #include "wtf/Noncopyable.h"
10
11 namespace blink {
12
13 class Visitor;
14 class WebFrame;
15
16 // Small helper class to track the set of frames that a WebFrame has opened.
17 // Due to layering restrictions, we need to hide the implementation, since
18 // public/web/ cannot depend on wtf/.
19 class OpenedFrameTracker {
20     WTF_MAKE_NONCOPYABLE(OpenedFrameTracker);
21 public:
22     OpenedFrameTracker();
23     ~OpenedFrameTracker();
24
25     bool isEmpty() const;
26     void add(WebFrame*);
27     void remove(WebFrame*);
28
29     // Updates the opener for all tracked frames.
30     void updateOpener(WebFrame*);
31
32     void traceFrames(Visitor*);
33
34 private:
35     WTF::HashSet<WebFrame*> m_openedFrames;
36 };
37
38 } // namespace blink
39
40 #endif // WebFramePrivate_h