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

Side by Side Diff: chrome/browser/importer/profile_import_process_messages.h

Issue 10021008: Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/importer/ie_importer.cc ('k') | chrome/browser/instant/instant_browsertest.cc » ('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 // 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"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 l->append("("); 182 l->append("(");
183 LogParam(p.favicon_url, l); 183 LogParam(p.favicon_url, l);
184 l->append(", "); 184 l->append(", ");
185 LogParam(p.png_data, l); 185 LogParam(p.png_data, l);
186 l->append(", "); 186 l->append(", ");
187 LogParam(p.urls, l); 187 LogParam(p.urls, l);
188 l->append(")"); 188 l->append(")");
189 } 189 }
190 }; // ParamTraits<history::ImportedFaviconUsage 190 }; // ParamTraits<history::ImportedFaviconUsage
191 191
192 // Traits for TemplateURLData
193 template <>
194 struct ParamTraits<TemplateURLData> {
195 typedef TemplateURLData param_type;
196 static void Write(Message* m, const param_type& p) {
197 WriteParam(m, p.short_name);
198 WriteParam(m, p.raw_keyword());
199 WriteParam(m, p.autogenerate_keyword());
200 WriteParam(m, p.url());
201 WriteParam(m, p.suggestions_url);
202 WriteParam(m, p.instant_url);
203 WriteParam(m, p.favicon_url);
204 WriteParam(m, p.originating_url);
205 WriteParam(m, p.show_in_default_list);
206 WriteParam(m, p.safe_for_autoreplace);
207 WriteParam(m, p.input_encodings);
208 WriteParam(m, p.id);
209 WriteParam(m, p.date_created);
210 WriteParam(m, p.last_modified);
211 WriteParam(m, p.created_by_policy);
212 WriteParam(m, p.usage_count);
213 WriteParam(m, p.prepopulate_id);
214 WriteParam(m, p.sync_guid);
215 }
216 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
217 string16 keyword;
218 bool autogenerate_keyword;
219 std::string url;
220 if (!ReadParam(m, iter, &p->short_name) ||
221 !ReadParam(m, iter, &keyword) ||
222 !ReadParam(m, iter, &autogenerate_keyword) ||
223 !ReadParam(m, iter, &url) ||
224 !ReadParam(m, iter, &p->suggestions_url) ||
225 !ReadParam(m, iter, &p->instant_url) ||
226 !ReadParam(m, iter, &p->favicon_url) ||
227 !ReadParam(m, iter, &p->originating_url) ||
228 !ReadParam(m, iter, &p->show_in_default_list) ||
229 !ReadParam(m, iter, &p->safe_for_autoreplace) ||
230 !ReadParam(m, iter, &p->input_encodings) ||
231 !ReadParam(m, iter, &p->id) ||
232 !ReadParam(m, iter, &p->date_created) ||
233 !ReadParam(m, iter, &p->last_modified) ||
234 !ReadParam(m, iter, &p->created_by_policy) ||
235 !ReadParam(m, iter, &p->usage_count) ||
236 !ReadParam(m, iter, &p->prepopulate_id) ||
237 !ReadParam(m, iter, &p->sync_guid))
238 return false;
239 p->SetKeyword(keyword);
240 p->SetAutogenerateKeyword(autogenerate_keyword);
241 p->SetURL(url);
242 return true;
243 }
244 static void Log(const param_type& p, std::string* l) {
245 l->append("<TemplateURLData>");
246 }
247 };
248
192 // Traits for TemplateURL*. 249 // Traits for TemplateURL*.
193 // WARNING: These will cause us to allocate a new TemplateURL on the heap on the 250 // WARNING: These will cause us to allocate a new TemplateURL on the heap on the
194 // receiver side. Any messages using this type must have handlers that are 251 // receiver side. Any messages using this type must have handlers that are
195 // careful to properly take ownership and avoid leaks! See warning below on 252 // careful to properly take ownership and avoid leaks! See warning below on
196 // ProfileImportProcessHostMsg_NotifyKeywordsReady. 253 // ProfileImportProcessHostMsg_NotifyKeywordsReady.
197 template <> 254 template <>
198 struct ParamTraits<TemplateURL*> { 255 struct ParamTraits<TemplateURL*> {
199 typedef TemplateURL* param_type; 256 typedef TemplateURL* param_type;
200 static void Write(Message* m, const param_type& p) { 257 static void Write(Message* m, const param_type& p) {
201 WriteParam(m, p->short_name()); 258 WriteParam(m, p->data());
202 WriteParam(m, p->url());
203 WriteParam(m, p->suggestions_url());
204 WriteParam(m, p->instant_url());
205 WriteParam(m, p->originating_url());
206 WriteParam(m, p->keyword());
207 WriteParam(m, p->autogenerate_keyword());
208 WriteParam(m, p->show_in_default_list());
209 WriteParam(m, p->safe_for_autoreplace());
210 WriteParam(m, p->favicon_url());
211 WriteParam(m, p->input_encodings());
212 WriteParam(m, p->date_created());
213 WriteParam(m, p->last_modified());
214 WriteParam(m, p->usage_count());
215 WriteParam(m, p->prepopulate_id());
216 } 259 }
217 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { 260 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
218 string16 short_name; 261 TemplateURLData data;
219 std::string url; 262 if (!ReadParam(m, iter, &data))
220 std::string suggestions_url;
221 std::string instant_url;
222 GURL originating_url;
223 string16 keyword;
224 bool autogenerate_keyword;
225 bool show_in_default_list;
226 bool safe_for_autoreplace;
227 GURL favicon_url;
228 base::Time date_created;
229 base::Time last_modified;
230 int usage_count;
231 int prepopulate_id;
232 if (!ReadParam(m, iter, &short_name) ||
233 !ReadParam(m, iter, &url) ||
234 !ReadParam(m, iter, &suggestions_url) ||
235 !ReadParam(m, iter, &instant_url) ||
236 !ReadParam(m, iter, &originating_url) ||
237 !ReadParam(m, iter, &keyword) ||
238 !ReadParam(m, iter, &autogenerate_keyword) ||
239 !ReadParam(m, iter, &show_in_default_list) ||
240 !ReadParam(m, iter, &safe_for_autoreplace) ||
241 !ReadParam(m, iter, &favicon_url) ||
242 !ReadParam(m, iter, &date_created) ||
243 !ReadParam(m, iter, &last_modified) ||
244 !ReadParam(m, iter, &usage_count) ||
245 !ReadParam(m, iter, &prepopulate_id))
246 return false; 263 return false;
247 *p = new TemplateURL(); 264 *p = new TemplateURL(data);
248 (*p)->set_short_name(short_name);
249 (*p)->SetURL(url);
250 (*p)->SetSuggestionsURL(suggestions_url);
251 (*p)->SetInstantURL(suggestions_url);
252 (*p)->set_originating_url(originating_url);
253 (*p)->set_keyword(keyword);
254 (*p)->set_autogenerate_keyword(autogenerate_keyword);
255 (*p)->set_show_in_default_list(show_in_default_list);
256 (*p)->set_safe_for_autoreplace(safe_for_autoreplace);
257 (*p)->set_favicon_url(favicon_url);
258 (*p)->set_date_created(date_created);
259 (*p)->set_last_modified(last_modified);
260 (*p)->set_usage_count(usage_count);
261 (*p)->SetPrepopulateId(prepopulate_id);
262 return true; 265 return true;
263 } 266 }
264 static void Log(const param_type& p, std::string* l) { 267 static void Log(const param_type& p, std::string* l) {
265 l->append("<TemplateURL>"); 268 l->append("<TemplateURL>");
266 } 269 }
267 }; 270 };
268 271
269 } // namespace IPC 272 } // namespace IPC
270 273
271 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ 274 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 333
331 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, 334 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
332 webkit::forms::PasswordForm) 335 webkit::forms::PasswordForm)
333 336
334 // 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
335 // 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
336 // these pointers and ensure they're properly freed! 339 // these pointers and ensure they're properly freed!
337 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, 340 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady,
338 std::vector<TemplateURL*>, 341 std::vector<TemplateURL*>,
339 bool /* unique on host and path */) 342 bool /* unique on host and path */)
OLDNEW
« no previous file with comments | « chrome/browser/importer/ie_importer.cc ('k') | chrome/browser/instant/instant_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698