| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 continue; | 58 continue; |
| 59 } | 59 } |
| 60 [decoded_string addAttributes:it->ToAttributesDictionary() | 60 [decoded_string addAttributes:it->ToAttributesDictionary() |
| 61 range:range.ToNSRange()]; | 61 range:range.ToNSRange()]; |
| 62 } | 62 } |
| 63 return [decoded_string.release() autorelease]; | 63 return [decoded_string.release() autorelease]; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Data Types ////////////////////////////////////////////////////////////////// | 66 // Data Types ////////////////////////////////////////////////////////////////// |
| 67 | 67 |
| 68 AttributedStringCoder::EncodedString::EncodedString(string16 string) | 68 AttributedStringCoder::EncodedString::EncodedString(base::string16 string) |
| 69 : string_(string) { | 69 : string_(string) { |
| 70 } | 70 } |
| 71 | 71 |
| 72 AttributedStringCoder::EncodedString::EncodedString() | 72 AttributedStringCoder::EncodedString::EncodedString() |
| 73 : string_() { | 73 : string_() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 AttributedStringCoder::EncodedString::~EncodedString() { | 76 AttributedStringCoder::EncodedString::~EncodedString() { |
| 77 } | 77 } |
| 78 | 78 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, PickleIterator* 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 base::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())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 |