Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(930)

Unified Diff: Source/core/loader/NavigationScheduler.h

Issue 1164883002: Ignore attempts to navigate once a provisional commit has gotten too far along. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698