diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/web/OpenedFrameTracker.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/web/OpenedFrameTracker.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chromium/third_party/WebKit/Source/web/OpenedFrameTracker.h b/chromium/third_party/WebKit/Source/web/OpenedFrameTracker.h new file mode 100644 index 00000000000..d17e0f73bb3 --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/OpenedFrameTracker.h @@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef OpenedFrameTracker_h +#define OpenedFrameTracker_h + +#include "wtf/HashSet.h" +#include "wtf/Noncopyable.h" + +namespace blink { + +class WebFrame; + +// Small helper class to track the set of frames that a WebFrame has opened. +// Due to layering restrictions, we need to hide the implementation, since +// public/web/ cannot depend on wtf/. +class OpenedFrameTracker { + WTF_MAKE_NONCOPYABLE(OpenedFrameTracker); +public: + OpenedFrameTracker(); + ~OpenedFrameTracker(); + + bool isEmpty() const; + void add(WebFrame*); + void remove(WebFrame*); + + // Updates the opener for all tracked frames. + void updateOpener(WebFrame*); + +private: + WTF::HashSet<WebFrame*> m_openedFrames; +}; + +} // namespace blink + +#endif // WebFramePrivate_h |