OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/common_param_traits.h" | 5 #include "chrome/common/common_param_traits.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
9 #include "chrome/common/content_settings.h" | 9 #include "chrome/common/content_settings.h" |
10 #include "chrome/common/thumbnail_score.h" | 10 #include "chrome/common/thumbnail_score.h" |
11 #include "chrome/common/web_apps.h" | 11 #include "chrome/common/web_apps.h" |
12 #include "content/common/common_param_traits.h" | 12 #include "content/common/common_param_traits.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "printing/backend/print_backend.h" | 14 #include "printing/backend/print_backend.h" |
15 #include "printing/native_metafile.h" | 15 #include "printing/native_metafile.h" |
16 #include "printing/page_range.h" | 16 #include "printing/page_range.h" |
17 #include "webkit/glue/password_form.h" | |
18 | 17 |
19 namespace IPC { | 18 namespace IPC { |
20 | 19 |
21 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { | 20 void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { |
22 WriteParam(m, static_cast<int>(p)); | 21 WriteParam(m, static_cast<int>(p)); |
23 } | 22 } |
24 | 23 |
25 bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter, | 24 bool ParamTraits<ContentSetting>::Read(const Message* m, void** iter, |
26 param_type* r) { | 25 param_type* r) { |
27 int value; | 26 int value; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 r->at_top = at_top; | 141 r->at_top = at_top; |
143 r->time_at_snapshot = time_at_snapshot; | 142 r->time_at_snapshot = time_at_snapshot; |
144 return true; | 143 return true; |
145 } | 144 } |
146 | 145 |
147 void ParamTraits<ThumbnailScore>::Log(const param_type& p, std::string* l) { | 146 void ParamTraits<ThumbnailScore>::Log(const param_type& p, std::string* l) { |
148 l->append(base::StringPrintf("(%f, %d, %d)", | 147 l->append(base::StringPrintf("(%f, %d, %d)", |
149 p.boring_score, p.good_clipping, p.at_top)); | 148 p.boring_score, p.good_clipping, p.at_top)); |
150 } | 149 } |
151 | 150 |
152 void ParamTraits<webkit_glue::PasswordForm>::Write(Message* m, | |
153 const param_type& p) { | |
154 WriteParam(m, p.signon_realm); | |
155 WriteParam(m, p.origin); | |
156 WriteParam(m, p.action); | |
157 WriteParam(m, p.submit_element); | |
158 WriteParam(m, p.username_element); | |
159 WriteParam(m, p.username_value); | |
160 WriteParam(m, p.password_element); | |
161 WriteParam(m, p.password_value); | |
162 WriteParam(m, p.old_password_element); | |
163 WriteParam(m, p.old_password_value); | |
164 WriteParam(m, p.ssl_valid); | |
165 WriteParam(m, p.preferred); | |
166 WriteParam(m, p.blacklisted_by_user); | |
167 } | |
168 | |
169 bool ParamTraits<webkit_glue::PasswordForm>::Read(const Message* m, void** iter, | |
170 param_type* p) { | |
171 return | |
172 ReadParam(m, iter, &p->signon_realm) && | |
173 ReadParam(m, iter, &p->origin) && | |
174 ReadParam(m, iter, &p->action) && | |
175 ReadParam(m, iter, &p->submit_element) && | |
176 ReadParam(m, iter, &p->username_element) && | |
177 ReadParam(m, iter, &p->username_value) && | |
178 ReadParam(m, iter, &p->password_element) && | |
179 ReadParam(m, iter, &p->password_value) && | |
180 ReadParam(m, iter, &p->old_password_element) && | |
181 ReadParam(m, iter, &p->old_password_value) && | |
182 ReadParam(m, iter, &p->ssl_valid) && | |
183 ReadParam(m, iter, &p->preferred) && | |
184 ReadParam(m, iter, &p->blacklisted_by_user); | |
185 } | |
186 void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p, | |
187 std::string* l) { | |
188 l->append("<PasswordForm>"); | |
189 } | |
190 | |
191 void ParamTraits<printing::PageRange>::Write(Message* m, const param_type& p) { | 151 void ParamTraits<printing::PageRange>::Write(Message* m, const param_type& p) { |
Tom Sepez
2011/03/23 17:32:53
Can these be macrofied?
jam
2011/03/23 18:21:02
yep, i was only doing stuff for now that is moving
| |
192 WriteParam(m, p.from); | 152 WriteParam(m, p.from); |
193 WriteParam(m, p.to); | 153 WriteParam(m, p.to); |
194 } | 154 } |
195 | 155 |
196 bool ParamTraits<printing::PageRange>::Read( | 156 bool ParamTraits<printing::PageRange>::Read( |
197 const Message* m, void** iter, param_type* p) { | 157 const Message* m, void** iter, param_type* p) { |
198 return ReadParam(m, iter, &p->from) && | 158 return ReadParam(m, iter, &p->from) && |
199 ReadParam(m, iter, &p->to); | 159 ReadParam(m, iter, &p->to); |
200 } | 160 } |
201 | 161 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 l->append(","); | 215 l->append(","); |
256 LogParam(p.caps_mime_type, l); | 216 LogParam(p.caps_mime_type, l); |
257 l->append(","); | 217 l->append(","); |
258 LogParam(p.printer_defaults, l); | 218 LogParam(p.printer_defaults, l); |
259 l->append(","); | 219 l->append(","); |
260 LogParam(p.defaults_mime_type, l); | 220 LogParam(p.defaults_mime_type, l); |
261 l->append(")"); | 221 l->append(")"); |
262 } | 222 } |
263 | 223 |
264 } // namespace IPC | 224 } // namespace IPC |
OLD | NEW |