diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 23:48:30 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-03 23:48:30 +0000 |
commit | 5e36967c2b96745b13f3bc8d9ca56f62d888ae1d (patch) | |
tree | b0d19f0215e69041641f667af37cd493b748c4e2 /chrome/common | |
parent | 4eae2c4462379beaf4df96815a2cd95424dcd73e (diff) | |
download | chromium_src-5e36967c2b96745b13f3bc8d9ca56f62d888ae1d.zip chromium_src-5e36967c2b96745b13f3bc8d9ca56f62d888ae1d.tar.gz chromium_src-5e36967c2b96745b13f3bc8d9ca56f62d888ae1d.tar.bz2 |
Changes session restore to use a normal load rather than preferring
the cache. We need to do this else we don't honor page expiration and
end up showing stale data for some sites.
BUG=21195
TEST=make sure session restore works.
Review URL: http://codereview.chromium.org/341043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/render_messages.h | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 57ba3b4..87fc773 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -68,6 +68,21 @@ class SkBitmap; // Parameters structure for ViewMsg_Navigate, which has too many data // parameters to be reasonably put in a predefined IPC message. struct ViewMsg_Navigate_Params { + enum NavigationType { + // Reload the page. + RELOAD, + + // The navigation is the result of session restore and should honor the + // page's cache policy while restoring form state. This is set to true if + // restoring a tab/session from the previous session and the previous + // session did not crash. If this is not set and the page was restored then + // the page's cache policy is ignored and we load from the cache. + RESTORE, + + // Navigation type not categorized by the other types. + NORMAL + }; + // The page_id for this navigation, or -1 if it is a new navigation. Back, // Forward, and Reload navigations should have a valid page_id. If the load // succeeds, then this page_id will be reflected in the resultant @@ -87,9 +102,8 @@ struct ViewMsg_Navigate_Params { // Opaque history state (received by ViewHostMsg_UpdateState). std::string state; - // Specifies if the URL should be loaded using 'reload' semantics (i.e., - // bypassing any locally cached content). - bool reload; + // Type of navigation. + NavigationType navigation_type; // The time the request was created base::Time request_time; @@ -675,7 +689,7 @@ struct ParamTraits<ViewMsg_Navigate_Params> { WriteParam(m, p.referrer); WriteParam(m, p.transition); WriteParam(m, p.state); - WriteParam(m, p.reload); + WriteParam(m, p.navigation_type); WriteParam(m, p.request_time); } static bool Read(const Message* m, void** iter, param_type* p) { @@ -685,7 +699,7 @@ struct ParamTraits<ViewMsg_Navigate_Params> { ReadParam(m, iter, &p->referrer) && ReadParam(m, iter, &p->transition) && ReadParam(m, iter, &p->state) && - ReadParam(m, iter, &p->reload) && + ReadParam(m, iter, &p->navigation_type) && ReadParam(m, iter, &p->request_time); } static void Log(const param_type& p, std::wstring* l) { @@ -698,13 +712,49 @@ struct ParamTraits<ViewMsg_Navigate_Params> { l->append(L", "); LogParam(p.state, l); l->append(L", "); - LogParam(p.reload, l); + LogParam(p.navigation_type, l); l->append(L", "); LogParam(p.request_time, l); l->append(L")"); } }; +template<> +struct ParamTraits<ViewMsg_Navigate_Params::NavigationType> { + typedef ViewMsg_Navigate_Params::NavigationType param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<ViewMsg_Navigate_Params::NavigationType>(type); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + std::wstring event; + switch (p) { + case ViewMsg_Navigate_Params::RELOAD: + event = L"NavigationType_RELOAD"; + break; + + case ViewMsg_Navigate_Params::RESTORE: + event = L"NavigationType_RESTORE"; + break; + + case ViewMsg_Navigate_Params::NORMAL: + event = L"NavigationType_NORMAL"; + break; + + default: + event = L"NavigationType_UNKNOWN"; + break; + } + LogParam(event, l); + } +}; + // Traits for PasswordForm_Params structure to pack/unpack. template <> struct ParamTraits<webkit_glue::PasswordForm> { |