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 // static |
| 43 void ParamTraits<FaviconURL>::Write(Message* m, const param_type& p) { |
| 44 WriteParam(m, p.icon_url); |
| 45 WriteParam(m, p.icon_type); |
| 46 } |
| 47 |
| 48 // static |
| 49 bool ParamTraits<FaviconURL>::Read(const Message* m, |
| 50 void** iter, |
| 51 param_type* p) { |
| 52 return ReadParam(m, iter, &p->icon_url) && ReadParam(m, iter, &p->icon_type); |
| 53 } |
| 54 |
| 55 // static |
| 56 void ParamTraits<FaviconURL>::Log(const param_type& p, std::string* l) { |
| 57 l->append("<FaviconURL>"); |
| 58 } |
| 59 |
| 60 } // namespace IPC |
OLD | NEW |