| OLD | NEW |
| 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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 autofill_web_data)->InjectStartSyncFlare(flare); | 52 autofill_web_data)->InjectStartSyncFlare(flare); |
| 53 AutofillProfileSyncableService::CreateForWebDataService( | 53 AutofillProfileSyncableService::CreateForWebDataService( |
| 54 autofill_web_data, app_locale); | 54 autofill_web_data, app_locale); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 WebDataServiceWrapper::WebDataServiceWrapper() {} | 59 WebDataServiceWrapper::WebDataServiceWrapper() {} |
| 60 | 60 |
| 61 WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) { | 61 WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) { |
| 62 base::FilePath path = profile->GetPath(); | 62 base::FilePath profile_path = profile->GetPath(); |
| 63 path = path.Append(kWebDataFilename); | 63 base::FilePath path = profile_path.Append(kWebDataFilename); |
| 64 | 64 |
| 65 web_database_ = new WebDatabaseService(path); | 65 web_database_ = new WebDatabaseService(path); |
| 66 | 66 |
| 67 // All tables objects that participate in managing the database must | 67 // All tables objects that participate in managing the database must |
| 68 // be added here. | 68 // be added here. |
| 69 web_database_->AddTable( | 69 web_database_->AddTable( |
| 70 scoped_ptr<WebDatabaseTable>(new autofill::AutofillTable( | 70 scoped_ptr<WebDatabaseTable>(new autofill::AutofillTable( |
| 71 g_browser_process->GetApplicationLocale()))); | 71 g_browser_process->GetApplicationLocale()))); |
| 72 web_database_->AddTable( | 72 web_database_->AddTable( |
| 73 scoped_ptr<WebDatabaseTable>(new KeywordTable())); | 73 scoped_ptr<WebDatabaseTable>(new KeywordTable())); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 autofill_web_data_->Init(); | 92 autofill_web_data_->Init(); |
| 93 | 93 |
| 94 web_data_ = new WebDataService( | 94 web_data_ = new WebDataService( |
| 95 web_database_, base::Bind(&ProfileErrorCallback)); | 95 web_database_, base::Bind(&ProfileErrorCallback)); |
| 96 web_data_->Init(); | 96 web_data_->Init(); |
| 97 | 97 |
| 98 BrowserThread::PostTask( | 98 BrowserThread::PostTask( |
| 99 BrowserThread::DB, FROM_HERE, | 99 BrowserThread::DB, FROM_HERE, |
| 100 base::Bind(&InitSyncableServicesOnDBThread, | 100 base::Bind(&InitSyncableServicesOnDBThread, |
| 101 autofill_web_data_, | 101 autofill_web_data_, |
| 102 sync_start_util::GetFlareForSyncableService(path), | 102 sync_start_util::GetFlareForSyncableService(profile_path), |
| 103 g_browser_process->GetApplicationLocale())); | 103 g_browser_process->GetApplicationLocale())); |
| 104 } | 104 } |
| 105 | 105 |
| 106 WebDataServiceWrapper::~WebDataServiceWrapper() { | 106 WebDataServiceWrapper::~WebDataServiceWrapper() { |
| 107 } | 107 } |
| 108 | 108 |
| 109 void WebDataServiceWrapper::Shutdown() { | 109 void WebDataServiceWrapper::Shutdown() { |
| 110 autofill_web_data_->ShutdownOnUIThread(); | 110 autofill_web_data_->ShutdownOnUIThread(); |
| 111 web_data_->ShutdownOnUIThread(); | 111 web_data_->ShutdownOnUIThread(); |
| 112 web_database_->ShutdownDatabase(); | 112 web_database_->ShutdownDatabase(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 ProfileKeyedService* WebDataServiceFactory::BuildServiceInstanceFor( | 194 ProfileKeyedService* WebDataServiceFactory::BuildServiceInstanceFor( |
| 195 content::BrowserContext* profile) const { | 195 content::BrowserContext* profile) const { |
| 196 return new WebDataServiceWrapper(static_cast<Profile*>(profile)); | 196 return new WebDataServiceWrapper(static_cast<Profile*>(profile)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { | 199 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| OLD | NEW |