| 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 | 200 // Traits for importer::URLKeywordInfo |
| 201 template <> | 201 template <> |
| 202 struct ParamTraits<TemplateURLData> { | 202 struct ParamTraits<importer::URLKeywordInfo> { |
| 203 typedef TemplateURLData param_type; | 203 typedef importer::URLKeywordInfo param_type; |
| 204 static void Write(Message* m, const param_type& p) { | 204 static void Write(Message* m, const param_type& p) { |
| 205 WriteParam(m, p.short_name); | 205 WriteParam(m, p.url); |
| 206 WriteParam(m, p.keyword()); | 206 WriteParam(m, p.keyword); |
| 207 WriteParam(m, p.url()); | 207 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 } | 208 } |
| 209 |
| 223 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | 210 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { |
| 224 string16 keyword; | 211 return |
| 225 std::string url; | 212 ReadParam(m, iter, &p->url) && |
| 226 if (!ReadParam(m, iter, &p->short_name) || | 213 ReadParam(m, iter, &p->keyword) && |
| 227 !ReadParam(m, iter, &keyword) || | 214 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 } | 215 } |
| 216 |
| 248 static void Log(const param_type& p, std::string* l) { | 217 static void Log(const param_type& p, std::string* l) { |
| 249 l->append("<TemplateURLData>"); | 218 l->append("("); |
| 219 LogParam(p.url, l); |
| 220 l->append(", "); |
| 221 LogParam(p.keyword, l); |
| 222 l->append(", "); |
| 223 LogParam(p.display_name, l); |
| 224 l->append(")"); |
| 250 } | 225 } |
| 251 }; | 226 }; // 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 | 227 |
| 279 } // namespace IPC | 228 } // namespace IPC |
| 280 | 229 |
| 281 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 230 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
| 282 | 231 |
| 283 #define IPC_MESSAGE_START ProfileImportMsgStart | 232 #define IPC_MESSAGE_START ProfileImportMsgStart |
| 284 | 233 |
| 285 //----------------------------------------------------------------------------- | 234 //----------------------------------------------------------------------------- |
| 286 // ProfileImportProcess messages | 235 // ProfileImportProcess messages |
| 287 // These are messages sent from the browser to the profile import process. | 236 // 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 | 283 |
| 335 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, | 284 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, |
| 336 int /* total number of favicons */) | 285 int /* total number of favicons */) |
| 337 | 286 |
| 338 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, | 287 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, |
| 339 std::vector<ImportedFaviconUsage>) | 288 std::vector<ImportedFaviconUsage>) |
| 340 | 289 |
| 341 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 290 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
| 342 content::PasswordForm) | 291 content::PasswordForm) |
| 343 | 292 |
| 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, | 293 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
| 348 std::vector<TemplateURL*>, | 294 std::vector<importer::URLKeywordInfo>, // url_keywords |
| 349 bool /* unique on host and path */) | 295 bool /* unique on host and path */) |
| 296 |
| 297 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, |
| 298 std::vector<std::string>) // search_engine_data |
| 299 |
| OLD | NEW |