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

Side by Side Diff: chrome/browser/webdata/web_data_service_factory.cc

Issue 12937016: Rename AutofillWebDataServiceImpl --> AutofillWebDataService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove c/b/api/autofill_webdata_service.h Created 7 years, 9 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/webdata/web_data_service_factory.h" 5 #include "chrome/browser/webdata/web_data_service_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "chrome/browser/profiles/profile_dependency_manager.h" 9 #include "chrome/browser/profiles/profile_dependency_manager.h"
10 #include "chrome/browser/ui/profile_error_dialog.h" 10 #include "chrome/browser/ui/profile_error_dialog.h"
11 #include "chrome/browser/webdata/autocomplete_syncable_service.h" 11 #include "chrome/browser/webdata/autocomplete_syncable_service.h"
12 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" 12 #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
13 #include "chrome/browser/webdata/autofill_table.h" 13 #include "chrome/browser/webdata/autofill_table.h"
14 #include "chrome/browser/webdata/autofill_web_data_service_impl.h" 14 #include "chrome/browser/webdata/autofill_web_data_service.h"
15 #include "chrome/browser/webdata/keyword_table.h" 15 #include "chrome/browser/webdata/keyword_table.h"
16 #include "chrome/browser/webdata/logins_table.h" 16 #include "chrome/browser/webdata/logins_table.h"
17 #include "chrome/browser/webdata/token_service_table.h" 17 #include "chrome/browser/webdata/token_service_table.h"
18 #include "chrome/browser/webdata/web_apps_table.h" 18 #include "chrome/browser/webdata/web_apps_table.h"
19 #include "chrome/browser/webdata/web_data_service.h" 19 #include "chrome/browser/webdata/web_data_service.h"
20 #include "chrome/browser/webdata/web_intents_table.h" 20 #include "chrome/browser/webdata/web_intents_table.h"
21 #include "chrome/browser/webdata/webdata_constants.h" 21 #include "chrome/browser/webdata/webdata_constants.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
24 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 scoped_ptr<WebDatabaseTable>(new WebAppsTable())); 71 scoped_ptr<WebDatabaseTable>(new WebAppsTable()));
72 // TODO(thakis): Add a migration to delete the SQL table used by 72 // TODO(thakis): Add a migration to delete the SQL table used by
73 // WebIntentsTable, then remove this. 73 // WebIntentsTable, then remove this.
74 web_database_->AddTable( 74 web_database_->AddTable(
75 scoped_ptr<WebDatabaseTable>(new WebIntentsTable())); 75 scoped_ptr<WebDatabaseTable>(new WebIntentsTable()));
76 76
77 // TODO (caitkp): Rework the callbacks here. They're ugly. 77 // TODO (caitkp): Rework the callbacks here. They're ugly.
78 78
79 web_database_->LoadDatabase(WebDatabaseService::InitCallback()); 79 web_database_->LoadDatabase(WebDatabaseService::InitCallback());
80 80
81 autofill_web_data_ = new AutofillWebDataServiceImpl( 81 autofill_web_data_ = new AutofillWebDataService(
82 web_database_, base::Bind(&ProfileErrorCallback)); 82 web_database_, base::Bind(&ProfileErrorCallback));
83 autofill_web_data_->Init(); 83 autofill_web_data_->Init();
84 84
85 web_data_ = new WebDataService( 85 web_data_ = new WebDataService(
86 web_database_, base::Bind(&ProfileErrorCallback)); 86 web_database_, base::Bind(&ProfileErrorCallback));
87 web_data_->Init(); 87 web_data_->Init();
88 88
89 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 89 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
90 base::Bind(&InitSyncableServicesOnDBThread, 90 base::Bind(&InitSyncableServicesOnDBThread,
91 autofill_web_data_)); 91 autofill_web_data_));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // WebDataServiceFactory has no dependecies. 146 // WebDataServiceFactory has no dependecies.
147 } 147 }
148 148
149 WebDataServiceFactory::~WebDataServiceFactory() {} 149 WebDataServiceFactory::~WebDataServiceFactory() {}
150 150
151 // static 151 // static
152 WebDataServiceWrapper* WebDataServiceFactory::GetForProfile( 152 WebDataServiceWrapper* WebDataServiceFactory::GetForProfile(
153 Profile* profile, Profile::ServiceAccessType access_type) { 153 Profile* profile, Profile::ServiceAccessType access_type) {
154 // If |access_type| starts being used for anything other than this 154 // If |access_type| starts being used for anything other than this
155 // DCHECK, we need to start taking it as a parameter to 155 // DCHECK, we need to start taking it as a parameter to
156 // AutofillWebDataServiceImpl::FromBrowserContext (see above). 156 // AutofillWebDataService::FromBrowserContext (see above).
157 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); 157 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
158 return static_cast<WebDataServiceWrapper*>( 158 return static_cast<WebDataServiceWrapper*>(
159 GetInstance()->GetServiceForProfile(profile, true)); 159 GetInstance()->GetServiceForProfile(profile, true));
160 } 160 }
161 161
162 // static 162 // static
163 WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists( 163 WebDataServiceWrapper* WebDataServiceFactory::GetForProfileIfExists(
164 Profile* profile, Profile::ServiceAccessType access_type) { 164 Profile* profile, Profile::ServiceAccessType access_type) {
165 // If |access_type| starts being used for anything other than this 165 // If |access_type| starts being used for anything other than this
166 // DCHECK, we need to start taking it as a parameter to 166 // DCHECK, we need to start taking it as a parameter to
167 // AutofillWebDataServiceImpl::FromBrowserContext (see above). 167 // AutofillWebDataService::FromBrowserContext (see above).
168 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); 168 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
169 return static_cast<WebDataServiceWrapper*>( 169 return static_cast<WebDataServiceWrapper*>(
170 GetInstance()->GetServiceForProfile(profile, false)); 170 GetInstance()->GetServiceForProfile(profile, false));
171 } 171 }
172 172
173 // static 173 // static
174 WebDataServiceFactory* WebDataServiceFactory::GetInstance() { 174 WebDataServiceFactory* WebDataServiceFactory::GetInstance() {
175 return Singleton<WebDataServiceFactory>::get(); 175 return Singleton<WebDataServiceFactory>::get();
176 } 176 }
177 177
178 bool WebDataServiceFactory::ServiceRedirectedInIncognito() const { 178 bool WebDataServiceFactory::ServiceRedirectedInIncognito() const {
179 return true; 179 return true;
180 } 180 }
181 181
182 ProfileKeyedService* 182 ProfileKeyedService*
183 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const { 183 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const {
184 return new WebDataServiceWrapper(profile); 184 return new WebDataServiceWrapper(profile);
185 } 185 }
186 186
187 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { 187 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const {
188 return true; 188 return true;
189 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698