OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/common/common_param_traits_macros.h" | 12 #include "chrome/common/common_param_traits_macros.h" |
13 #include "chrome/common/importer/imported_bookmark_entry.h" | 13 #include "chrome/common/importer/imported_bookmark_entry.h" |
14 #include "chrome/common/importer/imported_favicon_usage.h" | 14 #include "chrome/common/importer/imported_favicon_usage.h" |
15 #include "chrome/common/importer/importer_autofill_form_data_entry.h" | |
15 #include "chrome/common/importer/importer_data_types.h" | 16 #include "chrome/common/importer/importer_data_types.h" |
16 #include "chrome/common/importer/importer_url_row.h" | 17 #include "chrome/common/importer/importer_url_row.h" |
17 #include "components/autofill/content/common/autofill_param_traits_macros.h" | 18 #include "components/autofill/content/common/autofill_param_traits_macros.h" |
18 #include "components/autofill/core/common/password_form.h" | 19 #include "components/autofill/core/common/password_form.h" |
19 #include "content/public/common/common_param_traits.h" | 20 #include "content/public/common/common_param_traits.h" |
20 #include "ipc/ipc_message_macros.h" | 21 #include "ipc/ipc_message_macros.h" |
21 #include "ipc/ipc_message_utils.h" | 22 #include "ipc/ipc_message_utils.h" |
22 | 23 |
23 #ifndef CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 24 #ifndef CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
24 #define CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 25 #define CHROME_COMMON_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 l->append("("); | 214 l->append("("); |
214 LogParam(p.url, l); | 215 LogParam(p.url, l); |
215 l->append(", "); | 216 l->append(", "); |
216 LogParam(p.keyword, l); | 217 LogParam(p.keyword, l); |
217 l->append(", "); | 218 l->append(", "); |
218 LogParam(p.display_name, l); | 219 LogParam(p.display_name, l); |
219 l->append(")"); | 220 l->append(")"); |
220 } | 221 } |
221 }; // ParamTraits<importer::URLKeywordInfo> | 222 }; // ParamTraits<importer::URLKeywordInfo> |
222 | 223 |
224 // Traits for ImporterAutofillFormDataEntry to pack/unpack. | |
225 template <> | |
226 struct ParamTraits<ImporterAutofillFormDataEntry> { | |
227 typedef ImporterAutofillFormDataEntry param_type; | |
228 static void Write(Message* m, const param_type& p) { | |
229 WriteParam(m, p.name); | |
230 WriteParam(m, p.value); | |
231 WriteParam(m, p.times_used); | |
232 WriteParam(m, p.first_used); | |
233 WriteParam(m, p.last_used); | |
234 } | |
235 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | |
236 base::string16 name; | |
237 base::string16 value; | |
238 int times_used; | |
239 base::Time first_used; | |
240 base::Time last_used; | |
241 if (!ReadParam(m, iter, &name) || | |
242 !ReadParam(m, iter, &value) || | |
243 !ReadParam(m, iter, ×_used) || | |
244 !ReadParam(m, iter, &first_used) || | |
245 !ReadParam(m, iter, &last_used)) | |
246 return false; | |
247 *p = ImporterAutofillFormDataEntry(); | |
248 p->name = name; | |
249 p->value = value; | |
250 p->times_used = times_used; | |
251 p->first_used = first_used; | |
252 p->last_used = last_used; | |
253 return true; | |
Ilya Sherman
2014/09/04 06:17:47
I think you can simplify this to look more like th
Nikhil
2014/09/04 06:34:30
Done.
| |
254 } | |
255 static void Log(const param_type& p, std::string* l) { | |
256 l->append("("); | |
257 LogParam(p.name, l); | |
258 l->append(", "); | |
259 LogParam(p.value, l); | |
260 l->append(", "); | |
261 LogParam(p.times_used, l); | |
262 l->append(", "); | |
263 LogParam(p.first_used, l); | |
264 l->append(", "); | |
265 LogParam(p.last_used, l); | |
266 l->append(")"); | |
267 } | |
268 }; // ParamTraits<ImporterAutofillFormDataEntry> | |
269 | |
223 #if defined(OS_WIN) | 270 #if defined(OS_WIN) |
224 // Traits for importer::ImporterIE7PasswordInfo | 271 // Traits for importer::ImporterIE7PasswordInfo |
225 template <> | 272 template <> |
226 struct ParamTraits<importer::ImporterIE7PasswordInfo> { | 273 struct ParamTraits<importer::ImporterIE7PasswordInfo> { |
227 typedef importer::ImporterIE7PasswordInfo param_type; | 274 typedef importer::ImporterIE7PasswordInfo param_type; |
228 static void Write(Message* m, const param_type& p) { | 275 static void Write(Message* m, const param_type& p) { |
229 WriteParam(m, p.url_hash); | 276 WriteParam(m, p.url_hash); |
230 WriteParam(m, p.encrypted_data); | 277 WriteParam(m, p.encrypted_data); |
231 WriteParam(m, p.date_created); | 278 WriteParam(m, p.date_created); |
232 } | 279 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 362 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
316 autofill::PasswordForm) | 363 autofill::PasswordForm) |
317 | 364 |
318 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, | 365 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
319 std::vector<importer::URLKeywordInfo>, // url_keywords | 366 std::vector<importer::URLKeywordInfo>, // url_keywords |
320 bool /* unique on host and path */) | 367 bool /* unique on host and path */) |
321 | 368 |
322 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, | 369 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, |
323 std::vector<std::string>) // search_engine_data | 370 std::vector<std::string>) // search_engine_data |
324 | 371 |
372 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_AutofillFormDataImportStart, | |
373 int /* total number of entries to be imported */) | |
374 | |
375 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_AutofillFormDataImportGroup, | |
376 std::vector<ImporterAutofillFormDataEntry>) | |
377 | |
325 #if defined(OS_WIN) | 378 #if defined(OS_WIN) |
326 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyIE7PasswordInfo, | 379 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyIE7PasswordInfo, |
327 importer::ImporterIE7PasswordInfo) // password_info | 380 importer::ImporterIE7PasswordInfo) // password_info |
328 #endif | 381 #endif |
OLD | NEW |