Home | History | Annotate | Download | only in web
      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 WebFrame;
     14 
     15 // Small helper class to track the set of frames that a WebFrame has opened.
     16 // Due to layering restrictions, we need to hide the implementation, since
     17 // public/web/ cannot depend on wtf/.
     18 class OpenedFrameTracker {
     19     WTF_MAKE_NONCOPYABLE(OpenedFrameTracker);
     20 public:
     21     OpenedFrameTracker();
     22     ~OpenedFrameTracker();
     23 
     24     bool isEmpty() const;
     25     void add(WebFrame*);
     26     void remove(WebFrame*);
     27 
     28     // Updates the opener for all tracked frames.
     29     void updateOpener(WebFrame*);
     30 
     31 private:
     32     WTF::HashSet<WebFrame*> m_openedFrames;
     33 };
     34 
     35 } // namespace blink
     36 
     37 #endif // WebFramePrivate_h
     38