| 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/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/bookmarks/imported_bookmark_entry.h" |
| 13 #include "chrome/browser/favicon/imported_favicon_usage.h" |
| 12 #include "chrome/browser/history/history_types.h" | 14 #include "chrome/browser/history/history_types.h" |
| 13 #include "chrome/browser/importer/importer_data_types.h" | 15 #include "chrome/browser/importer/importer_data_types.h" |
| 14 #include "chrome/browser/importer/profile_writer.h" | |
| 15 #include "chrome/browser/search_engines/template_url.h" | 16 #include "chrome/browser/search_engines/template_url.h" |
| 16 #include "chrome/common/common_param_traits_macros.h" | 17 #include "chrome/common/common_param_traits_macros.h" |
| 17 #include "content/public/common/common_param_traits.h" | 18 #include "content/public/common/common_param_traits.h" |
| 18 #include "content/public/common/password_form.h" | 19 #include "content/public/common/password_form.h" |
| 19 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
| 20 #include "ipc/ipc_message_utils.h" | 21 #include "ipc/ipc_message_utils.h" |
| 21 | 22 |
| 22 #ifndef CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 23 #ifndef CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
| 23 #define CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ | 24 #define CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ |
| 24 | 25 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 l->append(", "); | 119 l->append(", "); |
| 119 LogParam(p.typed_count(), l); | 120 LogParam(p.typed_count(), l); |
| 120 l->append(", "); | 121 l->append(", "); |
| 121 LogParam(p.last_visit(), l); | 122 LogParam(p.last_visit(), l); |
| 122 l->append(", "); | 123 l->append(", "); |
| 123 LogParam(p.hidden(), l); | 124 LogParam(p.hidden(), l); |
| 124 l->append(")"); | 125 l->append(")"); |
| 125 } | 126 } |
| 126 }; // ParamTraits<history::URLRow> | 127 }; // ParamTraits<history::URLRow> |
| 127 | 128 |
| 128 // Traits for ProfileWriter::BookmarkEntry to pack/unpack. | 129 // Traits for ImportedBookmarkEntry to pack/unpack. |
| 129 template <> | 130 template <> |
| 130 struct ParamTraits<ProfileWriter::BookmarkEntry> { | 131 struct ParamTraits<ImportedBookmarkEntry> { |
| 131 typedef ProfileWriter::BookmarkEntry param_type; | 132 typedef ImportedBookmarkEntry param_type; |
| 132 static void Write(Message* m, const param_type& p) { | 133 static void Write(Message* m, const param_type& p) { |
| 133 WriteParam(m, p.in_toolbar); | 134 WriteParam(m, p.in_toolbar); |
| 134 WriteParam(m, p.is_folder); | 135 WriteParam(m, p.is_folder); |
| 135 WriteParam(m, p.url); | 136 WriteParam(m, p.url); |
| 136 WriteParam(m, p.path); | 137 WriteParam(m, p.path); |
| 137 WriteParam(m, p.title); | 138 WriteParam(m, p.title); |
| 138 WriteParam(m, p.creation_time); | 139 WriteParam(m, p.creation_time); |
| 139 } | 140 } |
| 140 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | 141 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { |
| 141 return | 142 return |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 l->append(", "); | 155 l->append(", "); |
| 155 LogParam(p.url, l); | 156 LogParam(p.url, l); |
| 156 l->append(", "); | 157 l->append(", "); |
| 157 LogParam(p.path, l); | 158 LogParam(p.path, l); |
| 158 l->append(", "); | 159 l->append(", "); |
| 159 LogParam(p.title, l); | 160 LogParam(p.title, l); |
| 160 l->append(", "); | 161 l->append(", "); |
| 161 LogParam(p.creation_time, l); | 162 LogParam(p.creation_time, l); |
| 162 l->append(")"); | 163 l->append(")"); |
| 163 } | 164 } |
| 164 }; // ParamTraits<ProfileWriter::BookmarkEntry> | 165 }; // ParamTraits<ImportedBookmarkEntry> |
| 165 | 166 |
| 166 // Traits for history::ImportedFaviconUsage. | 167 // Traits for ImportedFaviconUsage. |
| 167 template <> | 168 template <> |
| 168 struct ParamTraits<history::ImportedFaviconUsage> { | 169 struct ParamTraits<ImportedFaviconUsage> { |
| 169 typedef history::ImportedFaviconUsage param_type; | 170 typedef ImportedFaviconUsage param_type; |
| 170 static void Write(Message* m, const param_type& p) { | 171 static void Write(Message* m, const param_type& p) { |
| 171 WriteParam(m, p.favicon_url); | 172 WriteParam(m, p.favicon_url); |
| 172 WriteParam(m, p.png_data); | 173 WriteParam(m, p.png_data); |
| 173 WriteParam(m, p.urls); | 174 WriteParam(m, p.urls); |
| 174 } | 175 } |
| 175 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { | 176 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { |
| 176 return | 177 return |
| 177 ReadParam(m, iter, &p->favicon_url) && | 178 ReadParam(m, iter, &p->favicon_url) && |
| 178 ReadParam(m, iter, &p->png_data) && | 179 ReadParam(m, iter, &p->png_data) && |
| 179 ReadParam(m, iter, &p->urls); | 180 ReadParam(m, iter, &p->urls); |
| 180 } | 181 } |
| 181 static void Log(const param_type& p, std::string* l) { | 182 static void Log(const param_type& p, std::string* l) { |
| 182 l->append("("); | 183 l->append("("); |
| 183 LogParam(p.favicon_url, l); | 184 LogParam(p.favicon_url, l); |
| 184 l->append(", "); | 185 l->append(", "); |
| 185 LogParam(p.png_data, l); | 186 LogParam(p.png_data, l); |
| 186 l->append(", "); | 187 l->append(", "); |
| 187 LogParam(p.urls, l); | 188 LogParam(p.urls, l); |
| 188 l->append(")"); | 189 l->append(")"); |
| 189 } | 190 } |
| 190 }; // ParamTraits<history::ImportedFaviconUsage | 191 }; // ParamTraits<ImportedFaviconUsage> |
| 191 | 192 |
| 192 // Traits for TemplateURLData | 193 // Traits for TemplateURLData |
| 193 template <> | 194 template <> |
| 194 struct ParamTraits<TemplateURLData> { | 195 struct ParamTraits<TemplateURLData> { |
| 195 typedef TemplateURLData param_type; | 196 typedef TemplateURLData param_type; |
| 196 static void Write(Message* m, const param_type& p) { | 197 static void Write(Message* m, const param_type& p) { |
| 197 WriteParam(m, p.short_name); | 198 WriteParam(m, p.short_name); |
| 198 WriteParam(m, p.keyword()); | 199 WriteParam(m, p.keyword()); |
| 199 WriteParam(m, p.url()); | 200 WriteParam(m, p.url()); |
| 200 WriteParam(m, p.suggestions_url); | 201 WriteParam(m, p.suggestions_url); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 /* To simplify IPC call, pass as an integer */) | 316 /* To simplify IPC call, pass as an integer */) |
| 316 | 317 |
| 317 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyHomePageImportReady, | 318 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyHomePageImportReady, |
| 318 GURL /* GURL of home page */) | 319 GURL /* GURL of home page */) |
| 319 | 320 |
| 320 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyBookmarksImportStart, | 321 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyBookmarksImportStart, |
| 321 string16 /* first folder name */, | 322 string16 /* first folder name */, |
| 322 int /* total number of bookmarks */) | 323 int /* total number of bookmarks */) |
| 323 | 324 |
| 324 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup, | 325 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup, |
| 325 std::vector<ProfileWriter::BookmarkEntry>) | 326 std::vector<ImportedBookmarkEntry>) |
| 326 | 327 |
| 327 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, | 328 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, |
| 328 int /* total number of favicons */) | 329 int /* total number of favicons */) |
| 329 | 330 |
| 330 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, | 331 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, |
| 331 std::vector<history::ImportedFaviconUsage>) | 332 std::vector<ImportedFaviconUsage>) |
| 332 | 333 |
| 333 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 334 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
| 334 content::PasswordForm) | 335 content::PasswordForm) |
| 335 | 336 |
| 336 // WARNING: The TemplateURL*s in the following message get heap-allocated on the | 337 // WARNING: The TemplateURL*s in the following message get heap-allocated on the |
| 337 // receiving end. The message handler for this message MUST take ownership of | 338 // receiving end. The message handler for this message MUST take ownership of |
| 338 // these pointers and ensure they're properly freed! | 339 // these pointers and ensure they're properly freed! |
| 339 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, | 340 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
| 340 std::vector<TemplateURL*>, | 341 std::vector<TemplateURL*>, |
| 341 bool /* unique on host and path */) | 342 bool /* unique on host and path */) |
| OLD | NEW |