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

Side by Side Diff: chrome/browser/importer/profile_writer.cc

Issue 480953002: Implement "Autofill form data" import for Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (simplify Read method) Created 6 years, 3 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
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 #include "chrome/browser/importer/profile_writer.h" 5 #include "chrome/browser/importer/profile_writer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/favicon/favicon_service.h" 18 #include "chrome/browser/favicon/favicon_service.h"
19 #include "chrome/browser/favicon/favicon_service_factory.h" 19 #include "chrome/browser/favicon/favicon_service_factory.h"
20 #include "chrome/browser/history/history_service.h" 20 #include "chrome/browser/history/history_service.h"
21 #include "chrome/browser/history/history_service_factory.h" 21 #include "chrome/browser/history/history_service_factory.h"
22 #include "chrome/browser/password_manager/password_store_factory.h" 22 #include "chrome/browser/password_manager/password_store_factory.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/search_engines/template_url_service_factory.h" 24 #include "chrome/browser/search_engines/template_url_service_factory.h"
25 #include "chrome/browser/webdata/web_data_service_factory.h"
25 #include "chrome/common/importer/imported_bookmark_entry.h" 26 #include "chrome/common/importer/imported_bookmark_entry.h"
26 #include "chrome/common/importer/imported_favicon_usage.h" 27 #include "chrome/common/importer/imported_favicon_usage.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
28 #include "components/bookmarks/browser/bookmark_model.h" 30 #include "components/bookmarks/browser/bookmark_model.h"
29 #include "components/password_manager/core/browser/password_store.h" 31 #include "components/password_manager/core/browser/password_store.h"
30 #include "components/search_engines/template_url.h" 32 #include "components/search_engines/template_url.h"
31 #include "components/search_engines/template_url_service.h" 33 #include "components/search_engines/template_url_service.h"
32 34
33 #if defined(OS_WIN) 35 #if defined(OS_WIN)
34 #include "chrome/browser/webdata/web_data_service_factory.h" 36 #include "chrome/browser/webdata/web_data_service_factory.h"
35 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h" 37 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h"
36 #endif 38 #endif
37 39
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 continue; 324 continue;
323 325
324 // Only add valid TemplateURLs to the model. 326 // Only add valid TemplateURLs to the model.
325 if ((*i)->url_ref().IsValid(model->search_terms_data())) { 327 if ((*i)->url_ref().IsValid(model->search_terms_data())) {
326 model->Add(*i); // Takes ownership. 328 model->Add(*i); // Takes ownership.
327 *i = NULL; // Prevent the vector from deleting *i later. 329 *i = NULL; // Prevent the vector from deleting *i later.
328 } 330 }
329 } 331 }
330 } 332 }
331 333
334 void ProfileWriter::AddAutofillFormDataEntries(
335 const std::vector<autofill::AutofillEntry>& autofill_entries) {
336 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
337 WebDataServiceFactory::GetAutofillWebDataForProfile(
338 profile_, Profile::EXPLICIT_ACCESS);
339 if (web_data_service.get())
340 web_data_service->UpdateAutofillEntries(autofill_entries);
341 }
342
332 ProfileWriter::~ProfileWriter() {} 343 ProfileWriter::~ProfileWriter() {}
OLDNEW
« no previous file with comments | « chrome/browser/importer/profile_writer.h ('k') | chrome/browser/resources/options/import_data_overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698