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

Unified Diff: chrome/common/common_param_traits.h

Issue 437077: Remember zoom on a per-host basis.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « chrome/chrome_browser.gypi ('k') | chrome/common/page_zoom.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/common_param_traits.h
===================================================================
--- chrome/common/common_param_traits.h (revision 33695)
+++ chrome/common/common_param_traits.h (working copy)
@@ -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,32 +91,55 @@
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) {
- l->append(StringPrintf(L"0x%X", p));
+ 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) {
+ LogParam(static_cast<int>(p), l);
+ }
+};
+
+
+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);
}
};
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | chrome/common/page_zoom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698