Chromium Code Reviews| Index: Source/core/loader/NavigationScheduler.h |
| diff --git a/Source/core/loader/NavigationScheduler.h b/Source/core/loader/NavigationScheduler.h |
| index 4baf377af2f0c3e362a2ce47595300018272beac..195211c26926b20a1715efcfd439292c13bcd3a9 100644 |
| --- a/Source/core/loader/NavigationScheduler.h |
| +++ b/Source/core/loader/NavigationScheduler.h |
| @@ -47,17 +47,17 @@ namespace blink { |
| class Document; |
| class FormSubmission; |
| class LocalFrame; |
| +class NavigationScheduler; |
| class ScheduledNavigation; |
| -class NavigationDisablerForBeforeUnload { |
| - WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); |
| - |
| +class NavigationDisabler { |
|
Nate Chapin
2015/06/09 00:15:20
I guess I'd prefer to leave the old name.
michaeln
2015/06/09 01:15:02
Done.
|
| + WTF_MAKE_NONCOPYABLE(NavigationDisabler); |
| public: |
| - NavigationDisablerForBeforeUnload() |
| + NavigationDisabler() |
| { |
| s_navigationDisableCount++; |
| } |
| - ~NavigationDisablerForBeforeUnload() |
| + ~NavigationDisabler() |
| { |
| ASSERT(s_navigationDisableCount); |
| s_navigationDisableCount--; |
| @@ -68,6 +68,16 @@ private: |
| static unsigned s_navigationDisableCount; |
| }; |
| +class FrameNavigationDisabler { |
| + WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler); |
| +public: |
| + explicit FrameNavigationDisabler(LocalFrame*); |
| + ~FrameNavigationDisabler(); |
| + |
| +private: |
| + NavigationScheduler& m_navigationScheduler; |
| +}; |
| + |
| class CORE_EXPORT NavigationScheduler final { |
| WTF_MAKE_NONCOPYABLE(NavigationScheduler); |
| DISALLOW_ALLOCATION(); |
| @@ -89,6 +99,12 @@ public: |
| DECLARE_TRACE(); |
| private: |
| + friend class FrameNavigationDisabler; |
| + |
| + void disableFrameNavigation() { ++m_disabledCount; } |
| + void enableFrameNavigation() { --m_disabledCount; } |
| + bool isFrameNavigationAllowed() const { return !m_disabledCount; } |
| + |
| bool shouldScheduleReload() const; |
| bool shouldScheduleNavigation(const String& url) const; |
| @@ -100,6 +116,7 @@ private: |
| RawPtrWillBeMember<LocalFrame> m_frame; |
| Timer<NavigationScheduler> m_timer; |
| OwnPtrWillBeMember<ScheduledNavigation> m_redirect; |
| + int m_disabledCount = 0; |
|
Nate Chapin
2015/06/09 00:15:20
I think it's blink standard to use initialziers ab
michaeln
2015/06/09 01:15:02
Done.
|
| }; |
| } // namespace blink |