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 // Multiply-included message file, no traditonal include guard. | 5 // Multiply-included message file, no traditonal include guard. |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 l->append("("); | 190 l->append("("); |
191 LogParam(p.favicon_url, l); | 191 LogParam(p.favicon_url, l); |
192 l->append(", "); | 192 l->append(", "); |
193 LogParam(p.png_data, l); | 193 LogParam(p.png_data, l); |
194 l->append(", "); | 194 l->append(", "); |
195 LogParam(p.urls, l); | 195 LogParam(p.urls, l); |
196 l->append(")"); | 196 l->append(")"); |
197 } | 197 } |
198 }; // ParamTraits<ImportedFaviconUsage> | 198 }; // ParamTraits<ImportedFaviconUsage> |
199 | 199 |
200 // Traits for TemplateURLData | |
201 template <> | 200 template <> |
gab
2013/06/27 22:07:29
Add a comment above this line:
// Traits for impor
ananta
2013/06/27 22:29:55
Done.
| |
202 struct ParamTraits<TemplateURLData> { | 201 struct ParamTraits<importer::URLKeywordInfo> { |
203 typedef TemplateURLData param_type; | 202 typedef importer::URLKeywordInfo param_type; |
204 static void Write(Message* m, const param_type& p) { | 203 static void Write(Message* m, const param_type& p) { |
205 WriteParam(m, p.short_name); | 204 WriteParam(m, p.url); |
206 WriteParam(m, p.keyword()); | 205 WriteParam(m, p.keyword); |
207 WriteParam(m, p.url()); | 206 WriteParam(m, p.display_name); |
208 WriteParam(m, p.suggestions_url); | |
209 WriteParam(m, p.instant_url); | |
210 WriteParam(m, p.favicon_url); | |
211 WriteParam(m, p.originating_url); | |
212 WriteParam(m, p.show_in_default_list); | |
213 WriteParam(m, p.safe_for_autoreplace); | |
214 WriteParam(m, p.input_encodings); | |
215 WriteParam(m, p.id); | |
216 WriteParam(m, p.date_created); | |
217 WriteParam(m, p.last_modified); | |
218 WriteParam(m, p.created_by_policy); | |
219 WriteParam(m, p.usage_count); | |
220 WriteParam(m, p.prepopulate_id); | |
221 WriteParam(m, p.sync_guid); | |
222 } | 207 } |
208 | |
223 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | 209 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { |
224 string16 keyword; | 210 return |
225 std::string url; | 211 ReadParam(m, iter, &p->url) && |
226 if (!ReadParam(m, iter, &p->short_name) || | 212 ReadParam(m, iter, &p->keyword) && |
227 !ReadParam(m, iter, &keyword) || | 213 ReadParam(m, iter, &p->display_name); |
228 !ReadParam(m, iter, &url) || | |
229 !ReadParam(m, iter, &p->suggestions_url) || | |
230 !ReadParam(m, iter, &p->instant_url) || | |
231 !ReadParam(m, iter, &p->favicon_url) || | |
232 !ReadParam(m, iter, &p->originating_url) || | |
233 !ReadParam(m, iter, &p->show_in_default_list) || | |
234 !ReadParam(m, iter, &p->safe_for_autoreplace) || | |
235 !ReadParam(m, iter, &p->input_encodings) || | |
236 !ReadParam(m, iter, &p->id) || | |
237 !ReadParam(m, iter, &p->date_created) || | |
238 !ReadParam(m, iter, &p->last_modified) || | |
239 !ReadParam(m, iter, &p->created_by_policy) || | |
240 !ReadParam(m, iter, &p->usage_count) || | |
241 !ReadParam(m, iter, &p->prepopulate_id) || | |
242 !ReadParam(m, iter, &p->sync_guid)) | |
243 return false; | |
244 p->SetKeyword(keyword); | |
245 p->SetURL(url); | |
246 return true; | |
247 } | 214 } |
215 | |
248 static void Log(const param_type& p, std::string* l) { | 216 static void Log(const param_type& p, std::string* l) { |
249 l->append("<TemplateURLData>"); | 217 l->append("("); |
218 LogParam(p.url, l); | |
219 l->append(", "); | |
220 LogParam(p.keyword, l); | |
221 l->append(", "); | |
222 LogParam(p.display_name, l); | |
223 l->append(")"); | |
250 } | 224 } |
251 }; | 225 }; // ParamTraits<importer::URLKeywordInfo> |
252 | |
253 // Traits for TemplateURL*. | |
254 // WARNING: These will cause us to allocate a new TemplateURL on the heap on the | |
255 // receiver side. Any messages using this type must have handlers that are | |
256 // careful to properly take ownership and avoid leaks! See warning below on | |
257 // ProfileImportProcessHostMsg_NotifyKeywordsReady. | |
258 template <> | |
259 struct ParamTraits<TemplateURL*> { | |
260 typedef TemplateURL* param_type; | |
261 static void Write(Message* m, const param_type& p) { | |
262 WriteParam(m, p->data()); | |
263 } | |
264 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | |
265 TemplateURLData data; | |
266 if (!ReadParam(m, iter, &data)) | |
267 return false; | |
268 // Since we don't have access to a Profile*, just supply NULL. The caller | |
269 // can create a new TemplateURL or modify this one (e.g. via | |
270 // TemplateURLService::AddAndSetProfile()) to correct this later. | |
271 *p = new TemplateURL(NULL, data); | |
272 return true; | |
273 } | |
274 static void Log(const param_type& p, std::string* l) { | |
275 l->append("<TemplateURL*>"); | |
276 } | |
277 }; | |
278 | 226 |
279 } // namespace IPC | 227 } // namespace IPC |
280 | 228 |
281 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 229 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
282 | 230 |
283 #define IPC_MESSAGE_START ProfileImportMsgStart | 231 #define IPC_MESSAGE_START ProfileImportMsgStart |
284 | 232 |
285 //----------------------------------------------------------------------------- | 233 //----------------------------------------------------------------------------- |
286 // ProfileImportProcess messages | 234 // ProfileImportProcess messages |
287 // These are messages sent from the browser to the profile import process. | 235 // These are messages sent from the browser to the profile import process. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 | 282 |
335 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, | 283 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, |
336 int /* total number of favicons */) | 284 int /* total number of favicons */) |
337 | 285 |
338 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, | 286 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, |
339 std::vector<ImportedFaviconUsage>) | 287 std::vector<ImportedFaviconUsage>) |
340 | 288 |
341 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 289 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
342 content::PasswordForm) | 290 content::PasswordForm) |
343 | 291 |
344 // WARNING: The TemplateURL*s in the following message get heap-allocated on the | |
345 // receiving end. The message handler for this message MUST take ownership of | |
346 // these pointers and ensure they're properly freed! | |
347 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, | 292 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
348 std::vector<TemplateURL*>, | 293 std::vector<importer::URLKeywordInfo>, // url_keywords |
349 bool /* unique on host and path */) | 294 bool /* unique on host and path */) |
295 | |
296 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, | |
297 std::vector<std::string>) // search_engine_data | |
298 | |
OLD | NEW |