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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool ProfileWriter::BookmarkModelIsLoaded() const { 80 bool ProfileWriter::BookmarkModelIsLoaded() const {
81 return BookmarkModelFactory::GetForProfile(profile_)->loaded(); 81 return BookmarkModelFactory::GetForProfile(profile_)->loaded();
82 } 82 }
83 83
84 bool ProfileWriter::TemplateURLServiceIsLoaded() const { 84 bool ProfileWriter::TemplateURLServiceIsLoaded() const {
85 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded(); 85 return TemplateURLServiceFactory::GetForProfile(profile_)->loaded();
86 } 86 }
87 87
88 void ProfileWriter::AddPasswordForm(const autofill::PasswordForm& form) { 88 void ProfileWriter::AddPasswordForm(const autofill::PasswordForm& form) {
89 PasswordStoreFactory::GetForProfile( 89 PasswordStoreFactory::GetForProfile(
90 profile_, Profile::EXPLICIT_ACCESS)->AddLogin(form); 90 profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddLogin(form);
91 } 91 }
92 92
93 #if defined(OS_WIN) 93 #if defined(OS_WIN)
94 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { 94 void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) {
95 WebDataServiceFactory::GetPasswordWebDataForProfile( 95 WebDataServiceFactory::GetPasswordWebDataForProfile(
96 profile_, Profile::EXPLICIT_ACCESS)->AddIE7Login(info); 96 profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddIE7Login(info);
97 } 97 }
98 #endif 98 #endif
99 99
100 void ProfileWriter::AddHistoryPage(const history::URLRows& page, 100 void ProfileWriter::AddHistoryPage(const history::URLRows& page,
101 history::VisitSource visit_source) { 101 history::VisitSource visit_source) {
102 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> 102 HistoryServiceFactory::GetForProfile(profile_,
103 AddPagesWithDetails(page, visit_source); 103 ServiceAccessType::EXPLICIT_ACCESS)
104 ->AddPagesWithDetails(page, visit_source);
104 } 105 }
105 106
106 void ProfileWriter::AddHomepage(const GURL& home_page) { 107 void ProfileWriter::AddHomepage(const GURL& home_page) {
107 DCHECK(profile_); 108 DCHECK(profile_);
108 109
109 PrefService* prefs = profile_->GetPrefs(); 110 PrefService* prefs = profile_->GetPrefs();
110 // NOTE: We set the kHomePage value, but keep the NewTab page as the homepage. 111 // NOTE: We set the kHomePage value, but keep the NewTab page as the homepage.
111 const PrefService::Preference* pref = prefs->FindPreference(prefs::kHomePage); 112 const PrefService::Preference* pref = prefs->FindPreference(prefs::kHomePage);
112 if (pref && !pref->IsManaged()) { 113 if (pref && !pref->IsManaged()) {
113 prefs->SetString(prefs::kHomePage, home_page.spec()); 114 prefs->SetString(prefs::kHomePage, home_page.spec());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 227
227 model->EndExtensiveChanges(); 228 model->EndExtensiveChanges();
228 229
229 // If the user was previously using a toolbar, we should show the bar. 230 // If the user was previously using a toolbar, we should show the bar.
230 if (import_to_top_level && !add_all_to_top_level) 231 if (import_to_top_level && !add_all_to_top_level)
231 ShowBookmarkBar(profile_); 232 ShowBookmarkBar(profile_);
232 } 233 }
233 234
234 void ProfileWriter::AddFavicons( 235 void ProfileWriter::AddFavicons(
235 const std::vector<ImportedFaviconUsage>& favicons) { 236 const std::vector<ImportedFaviconUsage>& favicons) {
236 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)-> 237 FaviconServiceFactory::GetForProfile(profile_,
237 SetImportedFavicons(favicons); 238 ServiceAccessType::EXPLICIT_ACCESS)
239 ->SetImportedFavicons(favicons);
238 } 240 }
239 241
240 typedef std::map<std::string, TemplateURL*> HostPathMap; 242 typedef std::map<std::string, TemplateURL*> HostPathMap;
241 243
242 // Returns the key for the map built by BuildHostPathMap. If url_string is not 244 // Returns the key for the map built by BuildHostPathMap. If url_string is not
243 // a valid URL, an empty string is returned, otherwise host+path is returned. 245 // a valid URL, an empty string is returned, otherwise host+path is returned.
244 static std::string HostPathKeyForURL(const GURL& url) { 246 static std::string HostPathKeyForURL(const GURL& url) {
245 return url.is_valid() ? url.host() + url.path() : std::string(); 247 return url.is_valid() ? url.host() + url.path() : std::string();
246 } 248 }
247 249
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 model->Add(*i); // Takes ownership. 330 model->Add(*i); // Takes ownership.
329 *i = NULL; // Prevent the vector from deleting *i later. 331 *i = NULL; // Prevent the vector from deleting *i later.
330 } 332 }
331 } 333 }
332 } 334 }
333 335
334 void ProfileWriter::AddAutofillFormDataEntries( 336 void ProfileWriter::AddAutofillFormDataEntries(
335 const std::vector<autofill::AutofillEntry>& autofill_entries) { 337 const std::vector<autofill::AutofillEntry>& autofill_entries) {
336 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 338 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
337 WebDataServiceFactory::GetAutofillWebDataForProfile( 339 WebDataServiceFactory::GetAutofillWebDataForProfile(
338 profile_, Profile::EXPLICIT_ACCESS); 340 profile_, ServiceAccessType::EXPLICIT_ACCESS);
339 if (web_data_service.get()) 341 if (web_data_service.get())
340 web_data_service->UpdateAutofillEntries(autofill_entries); 342 web_data_service->UpdateAutofillEntries(autofill_entries);
341 } 343 }
342 344
343 ProfileWriter::~ProfileWriter() {} 345 ProfileWriter::~ProfileWriter() {}
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_impl_unittest.cc ('k') | chrome/browser/importer/profile_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698