diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 23:49:51 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-04 23:49:51 +0000 |
commit | 40bd658fd9aeedc8f2f7cc17c835f41095df9189 (patch) | |
tree | 87e9562263a8a641f7d2da19f629a2737d67c041 /chrome/common/common_param_traits.h | |
parent | 1c42268bc05d715b59d1b535e432c0d9ef666113 (diff) | |
download | chromium_src-40bd658fd9aeedc8f2f7cc17c835f41095df9189.zip chromium_src-40bd658fd9aeedc8f2f7cc17c835f41095df9189.tar.gz chromium_src-40bd658fd9aeedc8f2f7cc17c835f41095df9189.tar.bz2 |
Remember zoom on a per-host basis.
BUG=567
TEST=Visit a page, zoom in or out, then navigate to a different host. The new page should not be zoomed. Go back, or restart, or open a new tab and navigate to the old page, and it should be zoomed.
Review URL: http://codereview.chromium.org/437077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/common_param_traits.h')
-rw-r--r-- | chrome/common/common_param_traits.h | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index cb0ba43..98f6bfb 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -14,6 +14,7 @@ #include <vector> #include "app/gfx/native_widget_types.h" +#include "chrome/common/page_zoom.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/transport_dib.h" #include "ipc/ipc_message_utils.h" @@ -90,14 +91,36 @@ template <> struct ParamTraits<gfx::NativeWindow> { typedef gfx::NativeWindow param_type; static void Write(Message* m, const param_type& p) { - m->WriteIntPtr(reinterpret_cast<intptr_t>(p)); + WriteParam(m, reinterpret_cast<intptr_t>(p)); } static bool Read(const Message* m, void** iter, param_type* r) { - DCHECK_EQ(sizeof(param_type), sizeof(intptr_t)); - return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r)); + intptr_t value; + if (!ReadParam(m, iter, &value)) + return false; + *r = reinterpret_cast<param_type>(value); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + LogParam(reinterpret_cast<intptr_t>(p), l); + } +}; + + +template <> +struct ParamTraits<PageZoom::Function> { + typedef PageZoom::Function param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, static_cast<int>(p)); + } + static bool Read(const Message* m, void** iter, param_type* r) { + int value; + if (!ReadParam(m, iter, &value)) + return false; + *r = static_cast<param_type>(value); + return true; } static void Log(const param_type& p, std::wstring* l) { - l->append(StringPrintf(L"0x%X", p)); + LogParam(static_cast<int>(p), l); } }; @@ -106,16 +129,17 @@ template <> struct ParamTraits<WindowOpenDisposition> { typedef WindowOpenDisposition param_type; static void Write(Message* m, const param_type& p) { - m->WriteInt(p); + WriteParam(m, static_cast<int>(p)); } static bool Read(const Message* m, void** iter, param_type* r) { - int temp; - bool res = m->ReadInt(iter, &temp); - *r = static_cast<WindowOpenDisposition>(temp); - return res; + int value; + if (!ReadParam(m, iter, &value)) + return false; + *r = static_cast<param_type>(value); + return true; } static void Log(const param_type& p, std::wstring* l) { - l->append(StringPrintf(L"%d", p)); + LogParam(static_cast<int>(p), l); } }; |