| OLD | NEW |
| 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/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
| 6 | 6 |
| 7 #include "content/public/common/content_constants.h" | 7 #include "content/public/common/content_constants.h" |
| 8 #include "content/public/common/page_state.h" |
| 8 #include "content/public/common/referrer.h" | 9 #include "content/public/common/referrer.h" |
| 9 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/rect_f.h" | 13 #include "ui/gfx/rect_f.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 struct SkBitmap_Data { | 17 struct SkBitmap_Data { |
| 17 // The configuration for the bitmap (bits per pixel, etc). | 18 // The configuration for the bitmap (bits per pixel, etc). |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 100 |
| 100 r->set_host(host); | 101 r->set_host(host); |
| 101 r->set_port(port); | 102 r->set_port(port); |
| 102 return true; | 103 return true; |
| 103 } | 104 } |
| 104 | 105 |
| 105 void ParamTraits<net::HostPortPair>::Log(const param_type& p, std::string* l) { | 106 void ParamTraits<net::HostPortPair>::Log(const param_type& p, std::string* l) { |
| 106 l->append(p.ToString()); | 107 l->append(p.ToString()); |
| 107 } | 108 } |
| 108 | 109 |
| 110 void ParamTraits<content::PageState>::Write( |
| 111 Message* m, const param_type& p) { |
| 112 WriteParam(m, p.ToEncodedData()); |
| 113 } |
| 114 |
| 115 bool ParamTraits<content::PageState>::Read( |
| 116 const Message* m, PickleIterator* iter, param_type* r) { |
| 117 std::string data; |
| 118 if (!ReadParam(m, iter, &data)) |
| 119 return false; |
| 120 *r = content::PageState::CreateFromEncodedData(data); |
| 121 return true; |
| 122 } |
| 123 |
| 124 void ParamTraits<content::PageState>::Log( |
| 125 const param_type& p, std::string* l) { |
| 126 l->append("("); |
| 127 LogParam(p.ToEncodedData(), l); |
| 128 l->append(")"); |
| 129 } |
| 130 |
| 109 void ParamTraits<content::Referrer>::Write( | 131 void ParamTraits<content::Referrer>::Write( |
| 110 Message* m, const param_type& p) { | 132 Message* m, const param_type& p) { |
| 111 WriteParam(m, p.url); | 133 WriteParam(m, p.url); |
| 112 WriteParam(m, p.policy); | 134 WriteParam(m, p.policy); |
| 113 } | 135 } |
| 114 | 136 |
| 115 bool ParamTraits<content::Referrer>::Read( | 137 bool ParamTraits<content::Referrer>::Read( |
| 116 const Message* m, PickleIterator* iter, param_type* r) { | 138 const Message* m, PickleIterator* iter, param_type* r) { |
| 117 return ReadParam(m, iter, &r->url) && ReadParam(m, iter, &r->policy); | 139 return ReadParam(m, iter, &r->url) && ReadParam(m, iter, &r->policy); |
| 118 } | 140 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 382 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 361 #include "content/public/common/common_param_traits_macros.h" | 383 #include "content/public/common/common_param_traits_macros.h" |
| 362 } // namespace IPC | 384 } // namespace IPC |
| 363 | 385 |
| 364 // Generate param traits log methods. | 386 // Generate param traits log methods. |
| 365 #include "ipc/param_traits_log_macros.h" | 387 #include "ipc/param_traits_log_macros.h" |
| 366 namespace IPC { | 388 namespace IPC { |
| 367 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 389 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
| 368 #include "content/public/common/common_param_traits_macros.h" | 390 #include "content/public/common/common_param_traits_macros.h" |
| 369 } // namespace IPC | 391 } // namespace IPC |
| OLD | NEW |