| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/common/webkit_param_traits.h" | |
| 6 | |
| 7 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" | |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" | |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" | |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" | |
| 11 | |
| 12 namespace IPC { | |
| 13 | |
| 14 void ParamTraits<WebKit::WebRect>::Write(Message* m, const param_type& p) { | |
| 15 WriteParam(m, p.x); | |
| 16 WriteParam(m, p.y); | |
| 17 WriteParam(m, p.width); | |
| 18 WriteParam(m, p.height); | |
| 19 } | |
| 20 | |
| 21 bool ParamTraits<WebKit::WebRect>::Read(const Message* m, void** iter, | |
| 22 param_type* p) { | |
| 23 return | |
| 24 ReadParam(m, iter, &p->x) && | |
| 25 ReadParam(m, iter, &p->y) && | |
| 26 ReadParam(m, iter, &p->width) && | |
| 27 ReadParam(m, iter, &p->height); | |
| 28 } | |
| 29 | |
| 30 void ParamTraits<WebKit::WebRect>::Log(const param_type& p, std::wstring* l) { | |
| 31 l->append(L"("); | |
| 32 LogParam(p.x, l); | |
| 33 l->append(L", "); | |
| 34 LogParam(p.y, l); | |
| 35 l->append(L", "); | |
| 36 LogParam(p.width, l); | |
| 37 l->append(L", "); | |
| 38 LogParam(p.height, l); | |
| 39 l->append(L")"); | |
| 40 } | |
| 41 | |
| 42 void ParamTraits<WebKit::WebScreenInfo>::Write(Message* m, const param_type& p)
{ | |
| 43 WriteParam(m, p.depth); | |
| 44 WriteParam(m, p.depthPerComponent); | |
| 45 WriteParam(m, p.isMonochrome); | |
| 46 WriteParam(m, p.rect); | |
| 47 WriteParam(m, p.availableRect); | |
| 48 } | |
| 49 | |
| 50 bool ParamTraits<WebKit::WebScreenInfo>::Read(const Message* m, void** iter, | |
| 51 param_type* p) { | |
| 52 return | |
| 53 ReadParam(m, iter, &p->depth) && | |
| 54 ReadParam(m, iter, &p->depthPerComponent) && | |
| 55 ReadParam(m, iter, &p->isMonochrome) && | |
| 56 ReadParam(m, iter, &p->rect) && | |
| 57 ReadParam(m, iter, &p->availableRect); | |
| 58 } | |
| 59 | |
| 60 void ParamTraits<WebKit::WebScreenInfo>::Log(const param_type& p, | |
| 61 std::wstring* l) { | |
| 62 l->append(L"("); | |
| 63 LogParam(p.depth, l); | |
| 64 l->append(L", "); | |
| 65 LogParam(p.depthPerComponent, l); | |
| 66 l->append(L", "); | |
| 67 LogParam(p.isMonochrome, l); | |
| 68 l->append(L", "); | |
| 69 LogParam(p.rect, l); | |
| 70 l->append(L", "); | |
| 71 LogParam(p.availableRect, l); | |
| 72 l->append(L")"); | |
| 73 } | |
| 74 | |
| 75 void ParamTraits<WebKit::WebFindOptions>::Write(Message* m, | |
| 76 const param_type& p) { | |
| 77 WriteParam(m, p.forward); | |
| 78 WriteParam(m, p.matchCase); | |
| 79 WriteParam(m, p.findNext); | |
| 80 } | |
| 81 | |
| 82 bool ParamTraits<WebKit::WebFindOptions>::Read(const Message* m, void** iter, | |
| 83 param_type* p) { | |
| 84 return | |
| 85 ReadParam(m, iter, &p->forward) && | |
| 86 ReadParam(m, iter, &p->matchCase) && | |
| 87 ReadParam(m, iter, &p->findNext); | |
| 88 } | |
| 89 | |
| 90 void ParamTraits<WebKit::WebFindOptions>::Log(const param_type& p, | |
| 91 std::wstring* l) { | |
| 92 l->append(L"("); | |
| 93 LogParam(p.forward, l); | |
| 94 l->append(L", "); | |
| 95 LogParam(p.matchCase, l); | |
| 96 l->append(L", "); | |
| 97 LogParam(p.findNext, l); | |
| 98 l->append(L")"); | |
| 99 } | |
| 100 | |
| 101 void ParamTraits<WebKit::WebMediaPlayerAction>::Write(Message* m, | |
| 102 const param_type& p) { | |
| 103 WriteParam(m, static_cast<int>(p.type)); | |
| 104 WriteParam(m, p.enable); | |
| 105 } | |
| 106 | |
| 107 bool ParamTraits<WebKit::WebMediaPlayerAction>::Read(const Message* m, | |
| 108 void** iter, | |
| 109 param_type* r) { | |
| 110 int temp; | |
| 111 if (!ReadParam(m, iter, &temp)) | |
| 112 return false; | |
| 113 r->type = static_cast<param_type::Type>(temp); | |
| 114 return ReadParam(m, iter, &r->enable); | |
| 115 } | |
| 116 | |
| 117 void ParamTraits<WebKit::WebMediaPlayerAction>::Log(const param_type& p, | |
| 118 std::wstring* l) { | |
| 119 l->append(L"("); | |
| 120 switch (p.type) { | |
| 121 case WebKit::WebMediaPlayerAction::Play: | |
| 122 l->append(L"Play"); | |
| 123 break; | |
| 124 case WebKit::WebMediaPlayerAction::Mute: | |
| 125 l->append(L"Mute"); | |
| 126 break; | |
| 127 case WebKit::WebMediaPlayerAction::Loop: | |
| 128 l->append(L"Loop"); | |
| 129 break; | |
| 130 default: | |
| 131 l->append(L"Unknown"); | |
| 132 break; | |
| 133 } | |
| 134 l->append(L", "); | |
| 135 LogParam(p.enable, l); | |
| 136 l->append(L")"); | |
| 137 } | |
| 138 | |
| 139 void ParamTraits<WebKit::WebCompositionUnderline>::Write(Message* m, | |
| 140 const param_type& p) { | |
| 141 WriteParam(m, p.startOffset); | |
| 142 WriteParam(m, p.endOffset); | |
| 143 WriteParam(m, p.color); | |
| 144 WriteParam(m, p.thick); | |
| 145 } | |
| 146 | |
| 147 bool ParamTraits<WebKit::WebCompositionUnderline>::Read( | |
| 148 const Message* m, void** iter, | |
| 149 param_type* p) { | |
| 150 return | |
| 151 ReadParam(m, iter, &p->startOffset) && | |
| 152 ReadParam(m, iter, &p->endOffset) && | |
| 153 ReadParam(m, iter, &p->color) && | |
| 154 ReadParam(m, iter, &p->thick); | |
| 155 } | |
| 156 | |
| 157 void ParamTraits<WebKit::WebCompositionUnderline>::Log(const param_type& p, | |
| 158 std::wstring* l) { | |
| 159 l->append(L"("); | |
| 160 LogParam(p.startOffset, l); | |
| 161 l->append(L","); | |
| 162 LogParam(p.endOffset, l); | |
| 163 l->append(L":"); | |
| 164 LogParam(p.color, l); | |
| 165 l->append(L":"); | |
| 166 LogParam(p.thick, l); | |
| 167 l->append(L")"); | |
| 168 } | |
| 169 | |
| 170 } // namespace IPC | |
| OLD | NEW |