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

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

Issue 9965143: Revert 130431 - Move the URL string from TemplateURLRef onto the owning TemplateURL. This will mak… (Closed) Base URL: svn://svn.chromium.org/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
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Traits for TemplateURL*. 192 // Traits for TemplateURL*.
193 // WARNING: These will cause us to allocate a new TemplateURL on the heap on the 193 // 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 194 // 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 195 // careful to properly take ownership and avoid leaks! See warning below on
196 // ProfileImportProcessHostMsg_NotifyKeywordsReady. 196 // ProfileImportProcessHostMsg_NotifyKeywordsReady.
197 template <> 197 template <>
198 struct ParamTraits<TemplateURL*> { 198 struct ParamTraits<TemplateURL*> {
199 typedef TemplateURL* param_type; 199 typedef TemplateURL* param_type;
200 static void Write(Message* m, const param_type& p) { 200 static void Write(Message* m, const param_type& p) {
201 WriteParam(m, p->short_name()); 201 WriteParam(m, p->short_name());
202 WriteParam(m, p->url()); 202 if (p->suggestions_url()) {
203 WriteParam(m, p->suggestions_url()); 203 WriteParam(m, true);
204 WriteParam(m, p->instant_url()); 204 WriteParam(m, p->suggestions_url()->url());
205 } else {
206 WriteParam(m, false);
207 }
208 WriteParam(m, p->url()->url());
205 WriteParam(m, p->originating_url()); 209 WriteParam(m, p->originating_url());
206 WriteParam(m, p->keyword()); 210 WriteParam(m, p->keyword());
207 WriteParam(m, p->autogenerate_keyword()); 211 WriteParam(m, p->autogenerate_keyword());
208 WriteParam(m, p->show_in_default_list()); 212 WriteParam(m, p->show_in_default_list());
209 WriteParam(m, p->safe_for_autoreplace()); 213 WriteParam(m, p->safe_for_autoreplace());
210 WriteParam(m, p->favicon_url()); 214 WriteParam(m, p->favicon_url());
211 WriteParam(m, p->input_encodings()); 215 WriteParam(m, p->input_encodings());
212 WriteParam(m, p->date_created()); 216 WriteParam(m, p->date_created());
213 WriteParam(m, p->last_modified()); 217 WriteParam(m, p->last_modified());
214 WriteParam(m, p->usage_count()); 218 WriteParam(m, p->usage_count());
215 WriteParam(m, p->prepopulate_id()); 219 WriteParam(m, p->prepopulate_id());
216 } 220 }
217 static bool Read(const Message* m, PickleIterator* iter, param_type* p) { 221 static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
222 *p = NULL;
223
218 string16 short_name; 224 string16 short_name;
225 bool includes_suggestions_url;
226 std::string suggestions_url;
219 std::string url; 227 std::string url;
220 std::string suggestions_url;
221 std::string instant_url;
222 GURL originating_url; 228 GURL originating_url;
223 string16 keyword; 229 string16 keyword;
224 bool autogenerate_keyword; 230 bool autogenerate_keyword;
225 bool show_in_default_list; 231 bool show_in_default_list;
226 bool safe_for_autoreplace; 232 bool safe_for_autoreplace;
227 GURL favicon_url; 233 GURL favicon_url;
228 base::Time date_created; 234 base::Time date_created;
229 base::Time last_modified; 235 base::Time last_modified;
230 int usage_count; 236 int usage_count;
231 int prepopulate_id; 237 int prepopulate_id;
232 if (!ReadParam(m, iter, &short_name) || 238
233 !ReadParam(m, iter, &url) || 239 if (!ReadParam(m, iter, &short_name))
234 !ReadParam(m, iter, &suggestions_url) || 240 return false;
235 !ReadParam(m, iter, &instant_url) || 241
242 if (!ReadParam(m, iter, &includes_suggestions_url))
243 return false;
244 if (includes_suggestions_url) {
245 if (!ReadParam(m, iter, &suggestions_url))
246 return false;
247 }
248
249 if (!ReadParam(m, iter, &url) ||
236 !ReadParam(m, iter, &originating_url) || 250 !ReadParam(m, iter, &originating_url) ||
237 !ReadParam(m, iter, &keyword) || 251 !ReadParam(m, iter, &keyword) ||
238 !ReadParam(m, iter, &autogenerate_keyword) || 252 !ReadParam(m, iter, &autogenerate_keyword) ||
239 !ReadParam(m, iter, &show_in_default_list) || 253 !ReadParam(m, iter, &show_in_default_list) ||
240 !ReadParam(m, iter, &safe_for_autoreplace) || 254 !ReadParam(m, iter, &safe_for_autoreplace))
241 !ReadParam(m, iter, &favicon_url) || 255 return false;
256
257 scoped_ptr<TemplateURL> turl(new TemplateURL());
258 if (!ReadParam(m, iter, &favicon_url) ||
242 !ReadParam(m, iter, &date_created) || 259 !ReadParam(m, iter, &date_created) ||
243 !ReadParam(m, iter, &last_modified) || 260 !ReadParam(m, iter, &last_modified) ||
244 !ReadParam(m, iter, &usage_count) || 261 !ReadParam(m, iter, &usage_count) ||
245 !ReadParam(m, iter, &prepopulate_id)) 262 !ReadParam(m, iter, &prepopulate_id))
246 return false; 263 return false;
247 *p = new TemplateURL(); 264
248 (*p)->set_short_name(short_name); 265 turl->set_short_name(short_name);
249 (*p)->SetURL(url); 266 turl->SetSuggestionsURL(suggestions_url);
250 (*p)->SetSuggestionsURL(suggestions_url); 267 turl->SetURL(url);
251 (*p)->SetInstantURL(suggestions_url); 268 turl->set_originating_url(originating_url);
252 (*p)->set_originating_url(originating_url); 269 turl->set_keyword(keyword);
253 (*p)->set_keyword(keyword); 270 turl->set_autogenerate_keyword(autogenerate_keyword);
254 (*p)->set_autogenerate_keyword(autogenerate_keyword); 271 turl->set_show_in_default_list(show_in_default_list);
255 (*p)->set_show_in_default_list(show_in_default_list); 272 turl->set_safe_for_autoreplace(safe_for_autoreplace);
256 (*p)->set_safe_for_autoreplace(safe_for_autoreplace); 273 turl->set_favicon_url(favicon_url);
257 (*p)->set_favicon_url(favicon_url); 274 turl->set_date_created(date_created);
258 (*p)->set_date_created(date_created); 275 turl->set_last_modified(last_modified);
259 (*p)->set_last_modified(last_modified); 276 turl->set_usage_count(usage_count);
260 (*p)->set_usage_count(usage_count); 277 turl->SetPrepopulateId(prepopulate_id);
261 (*p)->SetPrepopulateId(prepopulate_id); 278 *p = turl.release();
262 return true; 279 return true;
263 } 280 }
264 static void Log(const param_type& p, std::string* l) { 281 static void Log(const param_type& p, std::string* l) {
265 l->append("<TemplateURL>"); 282 l->append("<TemplateURL>");
266 } 283 }
267 }; 284 };
268 285
269 } // namespace IPC 286 } // namespace IPC
270 287
271 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_ 288 #endif // CHROME_BROWSER_IMPORTER_PROFILE_IMPORT_PROCESS_MESSAGES_H_
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 347
331 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady, 348 IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
332 webkit::forms::PasswordForm) 349 webkit::forms::PasswordForm)
333 350
334 // WARNING: The TemplateURL*s in the following message get heap-allocated on the 351 // 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 352 // receiving end. The message handler for this message MUST take ownership of
336 // these pointers and ensure they're properly freed! 353 // these pointers and ensure they're properly freed!
337 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady, 354 IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyKeywordsReady,
338 std::vector<TemplateURL*>, 355 std::vector<TemplateURL*>,
339 bool /* unique on host and path */) 356 bool /* unique on host and path */)
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.cc ('k') | chrome/browser/importer/profile_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698