Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/common/icon_messages.h" | |
| 6 | |
| 7 #include "content/common/common_param_traits.h" | |
| 8 | |
| 9 FaviconURL::FaviconURL() | |
| 10 : icon_type(INVALID_ICON) { | |
| 11 } | |
| 12 | |
| 13 FaviconURL::FaviconURL(const GURL& url, IconType type) | |
| 14 : icon_url(url), | |
| 15 icon_type(type) { | |
| 16 } | |
| 17 | |
| 18 FaviconURL::~FaviconURL() { | |
| 19 } | |
| 20 | |
| 21 namespace IPC { | |
| 22 | |
| 23 // static | |
| 24 void ParamTraits<IconType>::Write(Message* m, const param_type& p) { | |
| 25 m->WriteInt(p); | |
| 26 } | |
| 27 | |
| 28 // static | |
| 29 bool ParamTraits<IconType>::Read(const Message* m, void** iter, param_type* p) { | |
| 30 int type; | |
| 31 if (!m->ReadInt(iter, &type)) | |
| 32 return false; | |
| 33 *p = static_cast<IconType>(type); | |
| 34 return true; | |
| 35 } | |
| 36 | |
| 37 // static | |
| 38 void ParamTraits<IconType>::Log(const param_type& p, std::string* l) { | |
| 39 l->append("IconType"); | |
| 40 } | |
| 41 | |
| 42 | |
|
sky
2011/03/22 19:48:48
remove one of these lines.
michaelbai
2011/03/22 23:59:03
Done.
| |
| 43 // static | |
| 44 void ParamTraits<FaviconURL>::Write(Message* m, const param_type& p) { | |
| 45 WriteParam(m, p.icon_url); | |
| 46 WriteParam(m, p.icon_type); | |
| 47 } | |
| 48 | |
| 49 // static | |
| 50 bool ParamTraits<FaviconURL>::Read(const Message* m, | |
| 51 void** iter, | |
| 52 param_type* p) { | |
| 53 return ReadParam(m, iter, &p->icon_url) && ReadParam(m, iter, &p->icon_type); | |
| 54 } | |
| 55 | |
| 56 // static | |
| 57 void ParamTraits<FaviconURL>::Log(const param_type& p, std::string* l) { | |
| 58 l->append("<FaviconURL>"); | |
| 59 } | |
| 60 | |
| 61 } // namespace IPC | |
| OLD | NEW |