Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef NavigationScheduler_h | 31 #ifndef NavigationScheduler_h |
| 32 #define NavigationScheduler_h | 32 #define NavigationScheduler_h |
| 33 | 33 |
| 34 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
| 35 #include "platform/heap/Handle.h" | |
| 35 #include "platform/weborigin/Referrer.h" | 36 #include "platform/weborigin/Referrer.h" |
| 36 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 37 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 38 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
| 39 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
| 40 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 42 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 60 { | 61 { |
| 61 ASSERT(s_navigationDisableCount); | 62 ASSERT(s_navigationDisableCount); |
| 62 s_navigationDisableCount--; | 63 s_navigationDisableCount--; |
| 63 } | 64 } |
| 64 static bool isNavigationAllowed() { return !s_navigationDisableCount; } | 65 static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 static unsigned s_navigationDisableCount; | 68 static unsigned s_navigationDisableCount; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 class NavigationScheduler { | 71 class NavigationScheduler FINAL { |
| 71 WTF_MAKE_NONCOPYABLE(NavigationScheduler); | 72 WTF_MAKE_NONCOPYABLE(NavigationScheduler); |
| 72 | 73 ALLOW_ONLY_INLINE_ALLOCATION(); |
|
haraken
2014/09/22 05:35:23
DISALLOW_ALLOCATION() ?
| |
| 73 public: | 74 public: |
| 74 explicit NavigationScheduler(LocalFrame*); | 75 explicit NavigationScheduler(LocalFrame*); |
| 75 ~NavigationScheduler(); | 76 ~NavigationScheduler(); |
| 76 | 77 |
| 77 bool locationChangePending(); | 78 bool locationChangePending(); |
| 78 | 79 |
| 79 void scheduleRedirect(double delay, const String& url); | 80 void scheduleRedirect(double delay, const String& url); |
| 80 void scheduleLocationChange(Document*, const String& url, const Referrer& re ferrer, bool lockBackForwardList = true); | 81 void scheduleLocationChange(Document*, const String& url, const Referrer& re ferrer, bool lockBackForwardList = true); |
| 81 void schedulePageBlock(Document*, const Referrer&); | 82 void schedulePageBlock(Document*, const Referrer&); |
| 82 void scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmission>); | 83 void scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmission>); |
| 83 void scheduleReload(); | 84 void scheduleReload(); |
| 84 void scheduleHistoryNavigation(int steps); | 85 void scheduleHistoryNavigation(int steps); |
| 85 | 86 |
| 86 void startTimer(); | 87 void startTimer(); |
| 87 void cancel(); | 88 void cancel(); |
| 88 | 89 |
| 90 void trace(Visitor*); | |
| 91 | |
| 89 private: | 92 private: |
| 90 bool shouldScheduleNavigation() const; | 93 bool shouldScheduleNavigation() const; |
| 91 bool shouldScheduleNavigation(const String& url) const; | 94 bool shouldScheduleNavigation(const String& url) const; |
| 92 | 95 |
| 93 void timerFired(Timer<NavigationScheduler>*); | 96 void timerFired(Timer<NavigationScheduler>*); |
| 94 void schedule(PassOwnPtr<ScheduledNavigation>); | 97 void schedule(PassOwnPtr<ScheduledNavigation>); |
| 95 | 98 |
| 96 static bool mustLockBackForwardList(LocalFrame* targetFrame); | 99 static bool mustLockBackForwardList(LocalFrame* targetFrame); |
| 97 | 100 |
| 98 LocalFrame* m_frame; | 101 RawPtrWillBeMember<LocalFrame> m_frame; |
| 99 Timer<NavigationScheduler> m_timer; | 102 Timer<NavigationScheduler> m_timer; |
| 100 OwnPtr<ScheduledNavigation> m_redirect; | 103 OwnPtr<ScheduledNavigation> m_redirect; |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 } // namespace blink | 106 } // namespace blink |
| 104 | 107 |
| 105 #endif // NavigationScheduler_h | 108 #endif // NavigationScheduler_h |
| OLD | NEW |