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/common/mac/attributed_string_coder.h" | 5 #include "content/common/mac/attributed_string_coder.h" |
6 | 6 |
7 #include <AppKit/AppKit.h> | 7 #include <AppKit/AppKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 using mac::AttributedStringCoder; | 122 using mac::AttributedStringCoder; |
123 | 123 |
124 void ParamTraits<AttributedStringCoder::EncodedString>::Write( | 124 void ParamTraits<AttributedStringCoder::EncodedString>::Write( |
125 Message* m, const param_type& p) { | 125 Message* m, const param_type& p) { |
126 WriteParam(m, p.string()); | 126 WriteParam(m, p.string()); |
127 WriteParam(m, p.attributes()); | 127 WriteParam(m, p.attributes()); |
128 } | 128 } |
129 | 129 |
130 bool ParamTraits<AttributedStringCoder::EncodedString>::Read( | 130 bool ParamTraits<AttributedStringCoder::EncodedString>::Read( |
131 const Message* m, PickleIterator* iter, param_type* p) { | 131 const Message* m, |
| 132 base::PickleIterator* iter, |
| 133 param_type* p) { |
132 bool success = true; | 134 bool success = true; |
133 | 135 |
134 base::string16 result; | 136 base::string16 result; |
135 success &= ReadParam(m, iter, &result); | 137 success &= ReadParam(m, iter, &result); |
136 *p = AttributedStringCoder::EncodedString(result); | 138 *p = AttributedStringCoder::EncodedString(result); |
137 | 139 |
138 success &= ReadParam(m, iter, p->attributes()); | 140 success &= ReadParam(m, iter, p->attributes()); |
139 return success; | 141 return success; |
140 } | 142 } |
141 | 143 |
142 void ParamTraits<AttributedStringCoder::EncodedString>::Log( | 144 void ParamTraits<AttributedStringCoder::EncodedString>::Log( |
143 const param_type& p, std::string* l) { | 145 const param_type& p, std::string* l) { |
144 l->append(base::UTF16ToUTF8(p.string())); | 146 l->append(base::UTF16ToUTF8(p.string())); |
145 } | 147 } |
146 | 148 |
147 void ParamTraits<AttributedStringCoder::FontAttribute>::Write( | 149 void ParamTraits<AttributedStringCoder::FontAttribute>::Write( |
148 Message* m, const param_type& p) { | 150 Message* m, const param_type& p) { |
149 WriteParam(m, p.font_descriptor()); | 151 WriteParam(m, p.font_descriptor()); |
150 WriteParam(m, p.effective_range()); | 152 WriteParam(m, p.effective_range()); |
151 } | 153 } |
152 | 154 |
153 bool ParamTraits<AttributedStringCoder::FontAttribute>::Read( | 155 bool ParamTraits<AttributedStringCoder::FontAttribute>::Read( |
154 const Message* m, PickleIterator* iter, param_type* p) { | 156 const Message* m, |
| 157 base::PickleIterator* iter, |
| 158 param_type* p) { |
155 bool success = true; | 159 bool success = true; |
156 | 160 |
157 FontDescriptor font; | 161 FontDescriptor font; |
158 success &= ReadParam(m, iter, &font); | 162 success &= ReadParam(m, iter, &font); |
159 | 163 |
160 gfx::Range range; | 164 gfx::Range range; |
161 success &= ReadParam(m, iter, &range); | 165 success &= ReadParam(m, iter, &range); |
162 | 166 |
163 if (success) { | 167 if (success) { |
164 *p = AttributedStringCoder::FontAttribute(font, range); | 168 *p = AttributedStringCoder::FontAttribute(font, range); |
165 } | 169 } |
166 return success; | 170 return success; |
167 } | 171 } |
168 | 172 |
169 void ParamTraits<AttributedStringCoder::FontAttribute>::Log( | 173 void ParamTraits<AttributedStringCoder::FontAttribute>::Log( |
170 const param_type& p, std::string* l) { | 174 const param_type& p, std::string* l) { |
171 } | 175 } |
172 | 176 |
173 } // namespace IPC | 177 } // namespace IPC |
OLD | NEW |