| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 4 * Copyright (C) 2009 Adam Barth. All rights reserved. | 4 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 void schedulePageBlock(Document*); | 68 void schedulePageBlock(Document*); |
| 69 void scheduleFormSubmission(Document*, PassRefPtrWillBeRawPtr<FormSubmission
>); | 69 void scheduleFormSubmission(Document*, PassRefPtrWillBeRawPtr<FormSubmission
>); |
| 70 void scheduleReload(); | 70 void scheduleReload(); |
| 71 | 71 |
| 72 void startTimer(); | 72 void startTimer(); |
| 73 void cancel(); | 73 void cancel(); |
| 74 | 74 |
| 75 DECLARE_TRACE(); | 75 DECLARE_TRACE(); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 friend class FrameNavigationDisabler; | |
| 79 explicit NavigationScheduler(LocalFrame*); | 78 explicit NavigationScheduler(LocalFrame*); |
| 80 | 79 |
| 81 void disableFrameNavigation() { ++m_navigationDisableCount; } | |
| 82 void enableFrameNavigation() { --m_navigationDisableCount; } | |
| 83 bool isFrameNavigationAllowed() const { return !m_navigationDisableCount; } | |
| 84 | |
| 85 bool shouldScheduleReload() const; | 80 bool shouldScheduleReload() const; |
| 86 bool shouldScheduleNavigation(const String& url) const; | 81 bool shouldScheduleNavigation(const String& url) const; |
| 87 | 82 |
| 88 void navigateTask(); | 83 void navigateTask(); |
| 89 void schedule(PassOwnPtrWillBeRawPtr<ScheduledNavigation>); | 84 void schedule(PassOwnPtrWillBeRawPtr<ScheduledNavigation>); |
| 90 | 85 |
| 91 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); | 86 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); |
| 92 | 87 |
| 93 RawPtrWillBeMember<LocalFrame> m_frame; | 88 RawPtrWillBeMember<LocalFrame> m_frame; |
| 94 OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; | 89 OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; |
| 95 OwnPtrWillBeMember<ScheduledNavigation> m_redirect; | 90 OwnPtrWillBeMember<ScheduledNavigation> m_redirect; |
| 96 int m_navigationDisableCount; | |
| 97 }; | 91 }; |
| 98 | 92 |
| 99 class NavigationDisablerForBeforeUnload { | 93 class NavigationDisablerForBeforeUnload { |
| 100 WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); | 94 WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); |
| 101 STACK_ALLOCATED(); | 95 STACK_ALLOCATED(); |
| 102 public: | 96 public: |
| 103 NavigationDisablerForBeforeUnload() | 97 NavigationDisablerForBeforeUnload() |
| 104 { | 98 { |
| 105 s_navigationDisableCount++; | 99 s_navigationDisableCount++; |
| 106 } | 100 } |
| 107 ~NavigationDisablerForBeforeUnload() | 101 ~NavigationDisablerForBeforeUnload() |
| 108 { | 102 { |
| 109 ASSERT(s_navigationDisableCount); | 103 ASSERT(s_navigationDisableCount); |
| 110 s_navigationDisableCount--; | 104 s_navigationDisableCount--; |
| 111 } | 105 } |
| 112 static bool isNavigationAllowed() { return !s_navigationDisableCount; } | 106 static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| 113 | 107 |
| 114 private: | 108 private: |
| 115 static unsigned s_navigationDisableCount; | 109 static unsigned s_navigationDisableCount; |
| 116 }; | 110 }; |
| 117 | 111 |
| 118 class FrameNavigationDisabler { | |
| 119 WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler); | |
| 120 STACK_ALLOCATED(); | |
| 121 public: | |
| 122 explicit FrameNavigationDisabler(LocalFrame*); | |
| 123 ~FrameNavigationDisabler(); | |
| 124 | |
| 125 private: | |
| 126 RawPtrWillBeMember<NavigationScheduler> m_navigationScheduler; | |
| 127 }; | |
| 128 | |
| 129 } // namespace blink | 112 } // namespace blink |
| 130 | 113 |
| 131 #endif // NavigationScheduler_h | 114 #endif // NavigationScheduler_h |
| OLD | NEW |