| 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. | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 4 * (http://www.torchmobile.com/) | 4 * (http://www.torchmobile.com/) |
| 5 * Copyright (C) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef NavigationScheduler_h | 32 #ifndef NavigationScheduler_h |
| 33 #define NavigationScheduler_h | 33 #define NavigationScheduler_h |
| 34 | 34 |
| 35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
| 36 #include "platform/WebTaskRunner.h" | 36 #include "platform/WebTaskRunner.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/weborigin/KURL.h" |
| 38 #include "public/platform/WebScheduler.h" | 39 #include "public/platform/WebScheduler.h" |
| 39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 40 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
| 41 #include "wtf/Noncopyable.h" | 42 #include "wtf/Noncopyable.h" |
| 42 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 44 #include <memory> | 45 #include <memory> |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 | 48 |
| 48 class Document; | 49 class Document; |
| 49 class FormSubmission; | 50 class FormSubmission; |
| 50 class LocalFrame; | 51 class LocalFrame; |
| 51 class ScheduledNavigation; | 52 class ScheduledNavigation; |
| 52 | 53 |
| 53 class CORE_EXPORT NavigationScheduler final | 54 class CORE_EXPORT NavigationScheduler final |
| 54 : public GarbageCollectedFinalized<NavigationScheduler> { | 55 : public GarbageCollectedFinalized<NavigationScheduler> { |
| 55 WTF_MAKE_NONCOPYABLE(NavigationScheduler); | 56 WTF_MAKE_NONCOPYABLE(NavigationScheduler); |
| 56 | 57 |
| 57 public: | 58 public: |
| 58 static NavigationScheduler* create(LocalFrame* frame) { | 59 static NavigationScheduler* create(LocalFrame* frame) { |
| 59 return new NavigationScheduler(frame); | 60 return new NavigationScheduler(frame); |
| 60 } | 61 } |
| 61 | 62 |
| 62 ~NavigationScheduler(); | 63 ~NavigationScheduler(); |
| 63 | 64 |
| 64 bool locationChangePending(); | 65 bool locationChangePending(); |
| 65 bool isNavigationScheduledWithin(double intervalInSeconds) const; | 66 bool isNavigationScheduledWithin(double intervalInSeconds) const; |
| 66 | 67 |
| 67 void scheduleRedirect(double delay, const String& url); | 68 void scheduleRedirect(double delay, const KURL&); |
| 68 void scheduleLocationChange(Document*, | 69 void scheduleLocationChange(Document*, |
| 69 const String& url, | 70 const KURL&, |
| 70 bool replacesCurrentItem = true); | 71 bool replacesCurrentItem = true); |
| 71 void schedulePageBlock(Document*, int reason); | 72 void schedulePageBlock(Document*, int reason); |
| 72 void scheduleFormSubmission(Document*, FormSubmission*); | 73 void scheduleFormSubmission(Document*, FormSubmission*); |
| 73 void scheduleReload(); | 74 void scheduleReload(); |
| 74 | 75 |
| 75 void startTimer(); | 76 void startTimer(); |
| 76 void cancel(); | 77 void cancel(); |
| 77 | 78 |
| 78 DECLARE_TRACE(); | 79 DECLARE_TRACE(); |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 explicit NavigationScheduler(LocalFrame*); | 82 explicit NavigationScheduler(LocalFrame*); |
| 82 | 83 |
| 83 bool shouldScheduleReload() const; | 84 bool shouldScheduleReload() const; |
| 84 bool shouldScheduleNavigation(const String& url) const; | 85 bool shouldScheduleNavigation(const KURL&) const; |
| 85 | 86 |
| 86 void navigateTask(); | 87 void navigateTask(); |
| 87 void schedule(ScheduledNavigation*); | 88 void schedule(ScheduledNavigation*); |
| 88 | 89 |
| 89 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); | 90 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); |
| 90 | 91 |
| 91 Member<LocalFrame> m_frame; | 92 Member<LocalFrame> m_frame; |
| 92 TaskHandle m_navigateTaskHandle; | 93 TaskHandle m_navigateTaskHandle; |
| 93 Member<ScheduledNavigation> m_redirect; | 94 Member<ScheduledNavigation> m_redirect; |
| 94 | 95 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 } | 109 } |
| 109 static bool isNavigationAllowed() { return !s_navigationDisableCount; } | 110 static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 static unsigned s_navigationDisableCount; | 113 static unsigned s_navigationDisableCount; |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace blink | 116 } // namespace blink |
| 116 | 117 |
| 117 #endif // NavigationScheduler_h | 118 #endif // NavigationScheduler_h |
| OLD | NEW |