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