Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: content/common/mac/attributed_string_coder.mm

Issue 1659003003: IPC::Message -> base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more mac fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/mac/attributed_string_coder.h ('k') | content/common/media/media_param_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 } // namespace mac 116 } // namespace mac
117 117
118 // IPC ParamTraits specialization ////////////////////////////////////////////// 118 // IPC ParamTraits specialization //////////////////////////////////////////////
119 119
120 namespace IPC { 120 namespace IPC {
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 base::Pickle* m,
126 const param_type& p) {
126 WriteParam(m, p.string()); 127 WriteParam(m, p.string());
127 WriteParam(m, p.attributes()); 128 WriteParam(m, p.attributes());
128 } 129 }
129 130
130 bool ParamTraits<AttributedStringCoder::EncodedString>::Read( 131 bool ParamTraits<AttributedStringCoder::EncodedString>::Read(
131 const Message* m, 132 const base::Pickle* m,
132 base::PickleIterator* iter, 133 base::PickleIterator* iter,
133 param_type* p) { 134 param_type* p) {
134 bool success = true; 135 bool success = true;
135 136
136 base::string16 result; 137 base::string16 result;
137 success &= ReadParam(m, iter, &result); 138 success &= ReadParam(m, iter, &result);
138 *p = AttributedStringCoder::EncodedString(result); 139 *p = AttributedStringCoder::EncodedString(result);
139 140
140 success &= ReadParam(m, iter, p->attributes()); 141 success &= ReadParam(m, iter, p->attributes());
141 return success; 142 return success;
142 } 143 }
143 144
144 void ParamTraits<AttributedStringCoder::EncodedString>::Log( 145 void ParamTraits<AttributedStringCoder::EncodedString>::Log(
145 const param_type& p, std::string* l) { 146 const param_type& p, std::string* l) {
146 l->append(base::UTF16ToUTF8(p.string())); 147 l->append(base::UTF16ToUTF8(p.string()));
147 } 148 }
148 149
149 void ParamTraits<AttributedStringCoder::FontAttribute>::Write( 150 void ParamTraits<AttributedStringCoder::FontAttribute>::Write(
150 Message* m, const param_type& p) { 151 base::Pickle* m,
152 const param_type& p) {
151 WriteParam(m, p.font_descriptor()); 153 WriteParam(m, p.font_descriptor());
152 WriteParam(m, p.effective_range()); 154 WriteParam(m, p.effective_range());
153 } 155 }
154 156
155 bool ParamTraits<AttributedStringCoder::FontAttribute>::Read( 157 bool ParamTraits<AttributedStringCoder::FontAttribute>::Read(
156 const Message* m, 158 const base::Pickle* m,
157 base::PickleIterator* iter, 159 base::PickleIterator* iter,
158 param_type* p) { 160 param_type* p) {
159 bool success = true; 161 bool success = true;
160 162
161 FontDescriptor font; 163 FontDescriptor font;
162 success &= ReadParam(m, iter, &font); 164 success &= ReadParam(m, iter, &font);
163 165
164 gfx::Range range; 166 gfx::Range range;
165 success &= ReadParam(m, iter, &range); 167 success &= ReadParam(m, iter, &range);
166 168
167 if (success) { 169 if (success) {
168 *p = AttributedStringCoder::FontAttribute(font, range); 170 *p = AttributedStringCoder::FontAttribute(font, range);
169 } 171 }
170 return success; 172 return success;
171 } 173 }
172 174
173 void ParamTraits<AttributedStringCoder::FontAttribute>::Log( 175 void ParamTraits<AttributedStringCoder::FontAttribute>::Log(
174 const param_type& p, std::string* l) { 176 const param_type& p, std::string* l) {
175 } 177 }
176 178
177 } // namespace IPC 179 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/mac/attributed_string_coder.h ('k') | content/common/media/media_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698