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

Unified Diff: chrome/renderer/render_view.cc

Issue 113758: Remove the HistoryState property of WebRequest.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/glue/webframe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 16741)
+++ chrome/renderer/render_view.cc (working copy)
@@ -794,18 +794,6 @@
is_reload = false;
}
- WebRequestCachePolicy cache_policy;
- if (is_reload) {
- cache_policy = WebRequestReloadIgnoringCacheData;
- } else if (params.page_id != -1 || main_frame->GetInViewSourceMode()) {
- cache_policy = WebRequestReturnCacheDataElseLoad;
- } else {
- cache_policy = WebRequestUseProtocolCachePolicy;
- }
-
- scoped_ptr<WebRequest> request(WebRequest::Create(params.url));
- request->SetCachePolicy(cache_policy);
-
// A navigation resulting from loading a javascript URL should not be treated
// as a browser initiated event. Instead, we want it to look as if the page
// initiated any load resulting from JS execution.
@@ -814,18 +802,40 @@
params.page_id, params.transition, params.request_time));
}
- // If we are reloading, then WebKit will use the state of the current page.
- // Otherwise, we give it the state to navigate to.
- if (!is_reload)
- request->SetHistoryState(params.state);
+ // If we are reloading, then WebKit will use the history state of the current
+ // page, so we should just ignore any given history state. Otherwise, if we
+ // have history state, then we need to navigate to it, which corresponds to a
+ // back/forward navigation event.
+ if (!is_reload && !params.state.empty()) {
+ // We must know the page ID of the page we are navigating back to.
+ DCHECK(params.page_id != -1);
+ main_frame->LoadHistoryState(params.state);
+ } else {
+ // Navigate to the given URL.
+ scoped_ptr<WebRequest> request(WebRequest::Create(params.url));
- if (params.referrer.is_valid()) {
- request->SetHttpHeaderValue("Referer",
- params.referrer.spec());
+ // TODO(darin): WebFrame should just have a Reload method.
+
+ WebRequestCachePolicy cache_policy;
+ if (is_reload) {
+ cache_policy = WebRequestReloadIgnoringCacheData;
+ } else {
+ // A session history navigation should have been accompanied by state.
+ DCHECK(params.page_id == -1);
+ if (main_frame->GetInViewSourceMode()) {
+ cache_policy = WebRequestReturnCacheDataElseLoad;
+ } else {
+ cache_policy = WebRequestUseProtocolCachePolicy;
+ }
+ }
+ request->SetCachePolicy(cache_policy);
+
+ if (params.referrer.is_valid())
+ request->SetHttpHeaderValue("Referer", params.referrer.spec());
+
+ main_frame->LoadRequest(request.get());
}
- main_frame->LoadRequest(request.get());
-
// In case LoadRequest failed before DidCreateDataSource was called.
pending_navigation_state_.reset();
}
« no previous file with comments | « no previous file | webkit/glue/webframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698