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

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

Issue 10185008: Taking over issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 #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/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/bookmarks/bookmark_model.h" 15 #include "chrome/browser/bookmarks/bookmark_model.h"
16 #include "chrome/browser/password_manager/password_store.h" 16 #include "chrome/browser/password_manager/password_store.h"
17 #include "chrome/browser/password_manager/password_store_factory.h" 17 #include "chrome/browser/password_manager/password_store_factory.h"
18 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/search_engines/template_url.h" 20 #include "chrome/browser/search_engines/template_url.h"
21 #include "chrome/browser/search_engines/template_url_service.h" 21 #include "chrome/browser/search_engines/template_url_service.h"
22 #include "chrome/browser/search_engines/template_url_service_factory.h" 22 #include "chrome/browser/search_engines/template_url_service_factory.h"
23 #include "chrome/browser/webdata/web_data_service_factory.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
25 26
26 namespace { 27 namespace {
27 28
28 // Generates a unique folder name. If |folder_name| is not unique, then this 29 // Generates a unique folder name. If |folder_name| is not unique, then this
29 // repeatedly tests for '|folder_name| + (i)' until a unique name is found. 30 // repeatedly tests for '|folder_name| + (i)' until a unique name is found.
30 string16 GenerateUniqueFolderName(BookmarkModel* model, 31 string16 GenerateUniqueFolderName(BookmarkModel* model,
31 const string16& folder_name) { 32 const string16& folder_name) {
32 // Build a set containing the bookmark bar folder names. 33 // Build a set containing the bookmark bar folder names.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded(); 88 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded();
88 } 89 }
89 90
90 void ProfileWriter::AddPasswordForm(const webkit::forms::PasswordForm& form) { 91 void ProfileWriter::AddPasswordForm(const webkit::forms::PasswordForm& form) {
91 PasswordStoreFactory::GetForProfile( 92 PasswordStoreFactory::GetForProfile(
92 profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); 93 profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form);
93 } 94 }
94 95
95 #if defined(OS_WIN) 96 #if defined(OS_WIN)
96 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { 97 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) {
97 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS)->AddIE7Login(info); 98 WebDataServiceFactory::GetForProfile(
99 profile_, Profile::EXPLICIT_ACCESS)->AddIE7Login(info);
98 } 100 }
99 #endif 101 #endif
100 102
101 void ProfileWriter::AddHistoryPage(const history::URLRows& page, 103 void ProfileWriter::AddHistoryPage(const history::URLRows& page,
102 history::VisitSource visit_source) { 104 history::VisitSource visit_source) {
103 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS)-> 105 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS)->
104 AddPagesWithDetails(page, visit_source); 106 AddPagesWithDetails(page, visit_source);
105 } 107 }
106 108
107 void ProfileWriter::AddHomepage(const GURL& home_page) { 109 void ProfileWriter::AddHomepage(const GURL& home_page) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 318
317 // Only add valid TemplateURLs to the model. 319 // Only add valid TemplateURLs to the model.
318 if ((*i)->url_ref().IsValid()) { 320 if ((*i)->url_ref().IsValid()) {
319 model->AddAndSetProfile(*i, profile_); // Takes ownership. 321 model->AddAndSetProfile(*i, profile_); // Takes ownership.
320 *i = NULL; // Prevent the vector from deleting *i later. 322 *i = NULL; // Prevent the vector from deleting *i later.
321 } 323 }
322 } 324 }
323 } 325 }
324 326
325 ProfileWriter::~ProfileWriter() {} 327 ProfileWriter::~ProfileWriter() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698