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

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

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 unified diff | Download patch
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(LocalFrame* frame) OVERRIDE 107 virtual void fire(LocalFrame* 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 if (frame)
112 request.resourceRequest().initializeForMainResource(frame->isMainFra me());
111 request.setLockBackForwardList(lockBackForwardList()); 113 request.setLockBackForwardList(lockBackForwardList());
112 request.setClientRedirect(ClientRedirect); 114 request.setClientRedirect(ClientRedirect);
113 frame->loader().load(request); 115 frame->loader().load(request);
114 } 116 }
115 117
116 Document* originDocument() const { return m_originDocument.get(); } 118 Document* originDocument() const { return m_originDocument.get(); }
117 String url() const { return m_url; } 119 String url() const { return m_url; }
118 const Referrer& referrer() const { return m_referrer; } 120 const Referrer& referrer() const { return m_referrer; }
119 121
120 private: 122 private:
(...skipping 12 matching lines...) Expand all
133 135
134 virtual bool shouldStartTimer(LocalFrame* frame) OVERRIDE { return frame->lo ader().allAncestorsAreComplete(); } 136 virtual bool shouldStartTimer(LocalFrame* frame) OVERRIDE { return frame->lo ader().allAncestorsAreComplete(); }
135 137
136 virtual void fire(LocalFrame* frame) OVERRIDE 138 virtual void fire(LocalFrame* frame) OVERRIDE
137 { 139 {
138 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 140 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
139 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer()), "_self"); 141 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer()), "_self");
140 request.setLockBackForwardList(lockBackForwardList()); 142 request.setLockBackForwardList(lockBackForwardList());
141 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) 143 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url()))
142 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData); 144 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData);
145 if (frame)
146 request.resourceRequest().initializeForMainResource(frame->isMainFra me());
143 request.setClientRedirect(ClientRedirect); 147 request.setClientRedirect(ClientRedirect);
144 frame->loader().load(request); 148 frame->loader().load(request);
145 } 149 }
146 }; 150 };
147 151
148 class ScheduledLocationChange FINAL : public ScheduledURLNavigation { 152 class ScheduledLocationChange FINAL : public ScheduledURLNavigation {
149 public: 153 public:
150 ScheduledLocationChange(Document* originDocument, const String& url, const R eferrer& referrer, bool lockBackForwardList) 154 ScheduledLocationChange(Document* originDocument, const String& url, const R eferrer& referrer, bool lockBackForwardList)
151 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } 155 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { }
152 }; 156 };
153 157
154 class ScheduledRefresh FINAL : public ScheduledURLNavigation { 158 class ScheduledRefresh FINAL : public ScheduledURLNavigation {
155 public: 159 public:
156 ScheduledRefresh(Document* originDocument, const String& url, const Referrer & referrer) 160 ScheduledRefresh(Document* originDocument, const String& url, const Referrer & referrer)
157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true) 161 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true)
158 { 162 {
159 } 163 }
160 164
161 virtual void fire(LocalFrame* frame) OVERRIDE 165 virtual void fire(LocalFrame* frame) OVERRIDE
162 { 166 {
163 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 167 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
164 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self"); 168 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self");
169 if (frame)
170 request.resourceRequest().initializeForMainResource(frame->isMainFra me());
165 request.setLockBackForwardList(lockBackForwardList()); 171 request.setLockBackForwardList(lockBackForwardList());
166 request.setClientRedirect(ClientRedirect); 172 request.setClientRedirect(ClientRedirect);
167 frame->loader().load(request); 173 frame->loader().load(request);
168 } 174 }
169 }; 175 };
170 176
171 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation { 177 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation {
172 public: 178 public:
173 explicit ScheduledHistoryNavigation(int historySteps) 179 explicit ScheduledHistoryNavigation(int historySteps)
174 : ScheduledNavigation(0, false, true) 180 : ScheduledNavigation(0, false, true)
175 , m_historySteps(historySteps) 181 , m_historySteps(historySteps)
176 { 182 {
177 } 183 }
178 184
179 virtual void fire(LocalFrame* frame) OVERRIDE 185 virtual void fire(LocalFrame* frame) OVERRIDE
180 { 186 {
181 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 187 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
182 188
183 if (!m_historySteps) { 189 if (!m_historySteps) {
184 FrameLoadRequest frameRequest(frame->document(), ResourceRequest(fra me->document()->url())); 190 FrameLoadRequest frameRequest(frame->document(), ResourceRequest(fra me->document()->url()));
191 if (frame)
192 frameRequest.resourceRequest().initializeForMainResource(frame-> isMainFrame());
185 frameRequest.setLockBackForwardList(lockBackForwardList()); 193 frameRequest.setLockBackForwardList(lockBackForwardList());
186 // Special case for go(0) from a frame -> reload only the frame 194 // 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. 195 // To follow Firefox and IE's behavior, history reload can only navi gate the self frame.
188 frame->loader().load(frameRequest); 196 frame->loader().load(frameRequest);
189 return; 197 return;
190 } 198 }
191 // go(i!=0) from a frame navigates into the history of the frame only, 199 // 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. 200 // in both IE and NS (but not in Mozilla). We can't easily do that.
193 frame->page()->deprecatedLocalMainFrame()->loader().client()->navigateBa ckForward(m_historySteps); 201 frame->page()->deprecatedLocalMainFrame()->loader().client()->navigateBa ckForward(m_historySteps);
194 } 202 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 416
409 void NavigationScheduler::cancel() 417 void NavigationScheduler::cancel()
410 { 418 {
411 if (m_timer.isActive()) 419 if (m_timer.isActive())
412 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 420 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
413 m_timer.stop(); 421 m_timer.stop();
414 m_redirect.clear(); 422 m_redirect.clear();
415 } 423 }
416 424
417 } // namespace WebCore 425 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698