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

Side by Side Diff: Source/core/loader/NavigationScheduler.cpp

Issue 137943002: Update more core classes to use OVERRIDE / FINAL when needed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | Source/core/loader/SinkDocument.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 class ScheduledURLNavigation : public ScheduledNavigation { 97 class ScheduledURLNavigation : public ScheduledNavigation {
98 protected: 98 protected:
99 ScheduledURLNavigation(double delay, Document* originDocument, const String& url, const AtomicString& referrer, bool lockBackForwardList, bool isLocationCha nge) 99 ScheduledURLNavigation(double delay, Document* originDocument, const String& url, const AtomicString& referrer, bool lockBackForwardList, bool isLocationCha nge)
100 : ScheduledNavigation(delay, lockBackForwardList, isLocationChange) 100 : ScheduledNavigation(delay, lockBackForwardList, isLocationChange)
101 , m_originDocument(originDocument) 101 , m_originDocument(originDocument)
102 , m_url(url) 102 , m_url(url)
103 , m_referrer(referrer) 103 , m_referrer(referrer)
104 { 104 {
105 } 105 }
106 106
107 virtual void fire(Frame* frame) 107 virtual void fire(Frame* frame) OVERRIDE
108 { 108 {
109 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 109 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
110 FrameLoadRequest request(m_originDocument.get(), ResourceRequest(KURL(Pa rsedURLString, m_url), m_referrer), "_self"); 110 FrameLoadRequest request(m_originDocument.get(), ResourceRequest(KURL(Pa rsedURLString, m_url), m_referrer), "_self");
111 request.setLockBackForwardList(lockBackForwardList()); 111 request.setLockBackForwardList(lockBackForwardList());
112 request.setClientRedirect(ClientRedirect); 112 request.setClientRedirect(ClientRedirect);
113 frame->loader().load(request); 113 frame->loader().load(request);
114 } 114 }
115 115
116 Document* originDocument() const { return m_originDocument.get(); } 116 Document* originDocument() const { return m_originDocument.get(); }
117 String url() const { return m_url; } 117 String url() const { return m_url; }
118 const AtomicString& referrer() const { return m_referrer; } 118 const AtomicString& referrer() const { return m_referrer; }
119 119
120 private: 120 private:
121 RefPtr<Document> m_originDocument; 121 RefPtr<Document> m_originDocument;
122 String m_url; 122 String m_url;
123 AtomicString m_referrer; 123 AtomicString m_referrer;
124 }; 124 };
125 125
126 class ScheduledRedirect : public ScheduledURLNavigation { 126 class ScheduledRedirect FINAL : public ScheduledURLNavigation {
127 public: 127 public:
128 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool lockBackForwardList) 128 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool lockBackForwardList)
129 : ScheduledURLNavigation(delay, originDocument, url, nullAtom, lockBackF orwardList, false) 129 : ScheduledURLNavigation(delay, originDocument, url, nullAtom, lockBackF orwardList, false)
130 { 130 {
131 clearUserGesture(); 131 clearUserGesture();
132 } 132 }
133 133
134 virtual bool shouldStartTimer(Frame* frame) { return frame->loader().allAnce storsAreComplete(); } 134 virtual bool shouldStartTimer(Frame* frame) OVERRIDE { return frame->loader( ).allAncestorsAreComplete(); }
135 135
136 virtual void fire(Frame* frame) 136 virtual void fire(Frame* frame) OVERRIDE
137 { 137 {
138 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 138 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
139 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer()), "_self"); 139 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer()), "_self");
140 request.setLockBackForwardList(lockBackForwardList()); 140 request.setLockBackForwardList(lockBackForwardList());
141 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) 141 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url()))
142 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData); 142 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData);
143 request.setClientRedirect(ClientRedirect); 143 request.setClientRedirect(ClientRedirect);
144 frame->loader().load(request); 144 frame->loader().load(request);
145 } 145 }
146 }; 146 };
147 147
148 class ScheduledLocationChange : public ScheduledURLNavigation { 148 class ScheduledLocationChange FINAL : public ScheduledURLNavigation {
149 public: 149 public:
150 ScheduledLocationChange(Document* originDocument, const String& url, const A tomicString& referrer, bool lockBackForwardList) 150 ScheduledLocationChange(Document* originDocument, const String& url, const A tomicString& referrer, bool lockBackForwardList)
151 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } 151 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { }
152 }; 152 };
153 153
154 class ScheduledRefresh : public ScheduledURLNavigation { 154 class ScheduledRefresh FINAL : public ScheduledURLNavigation {
155 public: 155 public:
156 ScheduledRefresh(Document* originDocument, const String& url, const AtomicSt ring& referrer) 156 ScheduledRefresh(Document* originDocument, const String& url, const AtomicSt ring& referrer)
157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true) 157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true)
158 { 158 {
159 } 159 }
160 160
161 virtual void fire(Frame* frame) 161 virtual void fire(Frame* frame) OVERRIDE
162 { 162 {
163 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 163 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
164 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self"); 164 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self");
165 request.setLockBackForwardList(lockBackForwardList()); 165 request.setLockBackForwardList(lockBackForwardList());
166 request.setClientRedirect(ClientRedirect); 166 request.setClientRedirect(ClientRedirect);
167 frame->loader().load(request); 167 frame->loader().load(request);
168 } 168 }
169 }; 169 };
170 170
171 class ScheduledHistoryNavigation : public ScheduledNavigation { 171 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation {
172 public: 172 public:
173 explicit ScheduledHistoryNavigation(int historySteps) 173 explicit ScheduledHistoryNavigation(int historySteps)
174 : ScheduledNavigation(0, false, true) 174 : ScheduledNavigation(0, false, true)
175 , m_historySteps(historySteps) 175 , m_historySteps(historySteps)
176 { 176 {
177 } 177 }
178 178
179 virtual void fire(Frame* frame) 179 virtual void fire(Frame* frame) OVERRIDE
180 { 180 {
181 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 181 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
182 182
183 if (!m_historySteps) { 183 if (!m_historySteps) {
184 FrameLoadRequest frameRequest(frame->document(), ResourceRequest(fra me->document()->url())); 184 FrameLoadRequest frameRequest(frame->document(), ResourceRequest(fra me->document()->url()));
185 frameRequest.setLockBackForwardList(lockBackForwardList()); 185 frameRequest.setLockBackForwardList(lockBackForwardList());
186 // Special case for go(0) from a frame -> reload only the frame 186 // Special case for go(0) from a frame -> reload only the frame
187 // To follow Firefox and IE's behavior, history reload can only navi gate the self frame. 187 // To follow Firefox and IE's behavior, history reload can only navi gate the self frame.
188 frame->loader().load(frameRequest); 188 frame->loader().load(frameRequest);
189 return; 189 return;
190 } 190 }
191 // go(i!=0) from a frame navigates into the history of the frame only, 191 // go(i!=0) from a frame navigates into the history of the frame only,
192 // in both IE and NS (but not in Mozilla). We can't easily do that. 192 // in both IE and NS (but not in Mozilla). We can't easily do that.
193 frame->page()->mainFrame()->loader().client()->navigateBackForward(m_his torySteps); 193 frame->page()->mainFrame()->loader().client()->navigateBackForward(m_his torySteps);
194 } 194 }
195 195
196 private: 196 private:
197 int m_historySteps; 197 int m_historySteps;
198 }; 198 };
199 199
200 class ScheduledFormSubmission : public ScheduledNavigation { 200 class ScheduledFormSubmission FINAL : public ScheduledNavigation {
201 public: 201 public:
202 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBack ForwardList) 202 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBack ForwardList)
203 : ScheduledNavigation(0, lockBackForwardList, true) 203 : ScheduledNavigation(0, lockBackForwardList, true)
204 , m_submission(submission) 204 , m_submission(submission)
205 { 205 {
206 ASSERT(m_submission->state()); 206 ASSERT(m_submission->state());
207 } 207 }
208 208
209 virtual void fire(Frame* frame) 209 virtual void fire(Frame* frame) OVERRIDE
210 { 210 {
211 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 211 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
212 FrameLoadRequest frameRequest(m_submission->state()->sourceDocument()); 212 FrameLoadRequest frameRequest(m_submission->state()->sourceDocument());
213 m_submission->populateFrameLoadRequest(frameRequest); 213 m_submission->populateFrameLoadRequest(frameRequest);
214 frameRequest.setLockBackForwardList(lockBackForwardList()); 214 frameRequest.setLockBackForwardList(lockBackForwardList());
215 frameRequest.setTriggeringEvent(m_submission->event()); 215 frameRequest.setTriggeringEvent(m_submission->event());
216 frameRequest.setFormState(m_submission->state()); 216 frameRequest.setFormState(m_submission->state());
217 frame->loader().load(frameRequest); 217 frame->loader().load(frameRequest);
218 } 218 }
219 219
220 virtual bool isForm() const { return true; } 220 virtual bool isForm() const OVERRIDE { return true; }
221 FormSubmission* submission() const { return m_submission.get(); } 221 FormSubmission* submission() const { return m_submission.get(); }
222 222
223 private: 223 private:
224 RefPtr<FormSubmission> m_submission; 224 RefPtr<FormSubmission> m_submission;
225 }; 225 };
226 226
227 NavigationScheduler::NavigationScheduler(Frame* frame) 227 NavigationScheduler::NavigationScheduler(Frame* frame)
228 : m_frame(frame) 228 : m_frame(frame)
229 , m_timer(this, &NavigationScheduler::timerFired) 229 , m_timer(this, &NavigationScheduler::timerFired)
230 { 230 {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 395
396 void NavigationScheduler::cancel() 396 void NavigationScheduler::cancel()
397 { 397 {
398 if (m_timer.isActive()) 398 if (m_timer.isActive())
399 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 399 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
400 m_timer.stop(); 400 m_timer.stop();
401 m_redirect.clear(); 401 m_redirect.clear();
402 } 402 }
403 403
404 } // namespace WebCore 404 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | Source/core/loader/SinkDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698