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

Side by Side Diff: content/common/content_param_traits.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « content/common/content_param_traits.h ('k') | content/common/mac/attributed_string_coder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/content_param_traits.h" 5 #include "content/common/content_param_traits.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "net/base/ip_endpoint.h" 8 #include "net/base/ip_endpoint.h"
9 #include "ui/base/range/range.h" 9 #include "ui/gfx/range/range.h"
10 10
11 namespace { 11 namespace {
12 12
13 int WebInputEventSizeForType(WebKit::WebInputEvent::Type type) { 13 int WebInputEventSizeForType(WebKit::WebInputEvent::Type type) {
14 if (WebKit::WebInputEvent::isMouseEventType(type)) 14 if (WebKit::WebInputEvent::isMouseEventType(type))
15 return sizeof(WebKit::WebMouseEvent); 15 return sizeof(WebKit::WebMouseEvent);
16 if (type == WebKit::WebInputEvent::MouseWheel) 16 if (type == WebKit::WebInputEvent::MouseWheel)
17 return sizeof(WebKit::WebMouseWheelEvent); 17 return sizeof(WebKit::WebMouseWheelEvent);
18 if (WebKit::WebInputEvent::isKeyboardEventType(type)) 18 if (WebKit::WebInputEvent::isKeyboardEventType(type))
19 return sizeof(WebKit::WebKeyboardEvent); 19 return sizeof(WebKit::WebKeyboardEvent);
(...skipping 21 matching lines...) Expand all
41 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) 41 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port))
42 return false; 42 return false;
43 *p = net::IPEndPoint(address, port); 43 *p = net::IPEndPoint(address, port);
44 return true; 44 return true;
45 } 45 }
46 46
47 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { 47 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
48 LogParam("IPEndPoint:" + p.ToString(), l); 48 LogParam("IPEndPoint:" + p.ToString(), l);
49 } 49 }
50 50
51 void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) { 51 void ParamTraits<gfx::Range>::Write(Message* m, const gfx::Range& r) {
52 m->WriteUInt64(r.start()); 52 m->WriteUInt64(r.start());
53 m->WriteUInt64(r.end()); 53 m->WriteUInt64(r.end());
54 } 54 }
55 55
56 bool ParamTraits<ui::Range>::Read(const Message* m, 56 bool ParamTraits<gfx::Range>::Read(const Message* m,
57 PickleIterator* iter, 57 PickleIterator* iter,
58 ui::Range* r) { 58 gfx::Range* r) {
59 uint64 start, end; 59 uint64 start, end;
60 if (!m->ReadUInt64(iter, &start) || !m->ReadUInt64(iter, &end)) 60 if (!m->ReadUInt64(iter, &start) || !m->ReadUInt64(iter, &end))
61 return false; 61 return false;
62 r->set_start(start); 62 r->set_start(start);
63 r->set_end(end); 63 r->set_end(end);
64 return true; 64 return true;
65 } 65 }
66 66
67 void ParamTraits<ui::Range>::Log(const ui::Range& r, std::string* l) { 67 void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) {
68 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end())); 68 l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end()));
69 } 69 }
70 70
71 void ParamTraits<WebInputEventPointer>::Write(Message* m, const param_type& p) { 71 void ParamTraits<WebInputEventPointer>::Write(Message* m, const param_type& p) {
72 m->WriteData(reinterpret_cast<const char*>(p), p->size); 72 m->WriteData(reinterpret_cast<const char*>(p), p->size);
73 } 73 }
74 74
75 bool ParamTraits<WebInputEventPointer>::Read(const Message* m, 75 bool ParamTraits<WebInputEventPointer>::Read(const Message* m,
76 PickleIterator* iter, 76 PickleIterator* iter,
77 param_type* r) { 77 param_type* r) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 125 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
126 #include "content/common/content_param_traits_macros.h" 126 #include "content/common/content_param_traits_macros.h"
127 } // namespace IPC 127 } // namespace IPC
128 128
129 // Generate param traits log methods. 129 // Generate param traits log methods.
130 #include "ipc/param_traits_log_macros.h" 130 #include "ipc/param_traits_log_macros.h"
131 namespace IPC { 131 namespace IPC {
132 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 132 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
133 #include "content/common/content_param_traits_macros.h" 133 #include "content/common/content_param_traits_macros.h"
134 } // namespace IPC 134 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/content_param_traits.h ('k') | content/common/mac/attributed_string_coder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698