Index: third_party/WebKit/Source/core/frame/LocalFrame.h |
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h |
index be53fd431366d5cd10dc6c713d2baddf9155587e..03af3b9113454b72855eedf6cda93993578d4f34 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalFrame.h |
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.h |
@@ -184,13 +184,15 @@ public: |
bool shouldThrottleRendering() const; |
- // ======== |
- |
// Returns the frame scheduler, creating one if needed. |
WebFrameScheduler* frameScheduler(); |
void updateFrameSecurityOrigin(); |
+ bool isNavigationAllowed() const { return m_navigationDisableCount == 0; } |
+ |
private: |
+ friend class FrameNavigationDisabler; |
+ |
LocalFrame(FrameLoaderClient*, FrameHost*, FrameOwner*); |
// Internal Frame helper overrides: |
@@ -204,6 +206,9 @@ private: |
RespectImageOrientationEnum shouldRespectImageOrientation, const GlobalPaintFlags, |
IntRect paintingRect, float opacity = 1); |
+ void enableNavigation() { --m_navigationDisableCount; } |
+ void disableNavigation() { ++m_navigationDisableCount; } |
+ |
mutable FrameLoader m_loader; |
OwnPtrWillBeMember<NavigationScheduler> m_navigationScheduler; |
@@ -221,6 +226,8 @@ private: |
const OwnPtrWillBeMember<InputMethodController> m_inputMethodController; |
OwnPtr<WebFrameScheduler> m_frameScheduler; |
+ int m_navigationDisableCount; |
+ |
#if ENABLE(OILPAN) |
// Oilpan: in order to reliably finalize plugin elements with |
// renderer-less plugins, the frame keeps track of them. When |
@@ -327,6 +334,17 @@ DEFINE_TYPE_CASTS(LocalFrame, Frame, localFrame, localFrame->isLocalFrame(), loc |
DECLARE_WEAK_IDENTIFIER_MAP(LocalFrame); |
+class FrameNavigationDisabler { |
+ WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler); |
+ STACK_ALLOCATED(); |
+public: |
+ explicit FrameNavigationDisabler(LocalFrame&); |
+ ~FrameNavigationDisabler(); |
+ |
+private: |
+ RawPtrWillBeMember<LocalFrame> m_frame; |
+}; |
+ |
} // namespace blink |
// During refactoring, there are some places where we need to do type conversions that |