| 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/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "chrome/browser/profiles/profile_dependency_manager.h" | 8 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 9 #include "chrome/browser/webdata/autofill_web_data_service_impl.h" | 9 #include "chrome/browser/webdata/autofill_web_data_service_impl.h" |
| 10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 void WebDataServiceWrapper::Shutdown() { | 24 void WebDataServiceWrapper::Shutdown() { |
| 25 web_data_service_->ShutdownOnUIThread(); | 25 web_data_service_->ShutdownOnUIThread(); |
| 26 web_data_service_ = NULL; | 26 web_data_service_ = NULL; |
| 27 } | 27 } |
| 28 | 28 |
| 29 scoped_refptr<WebDataService> WebDataServiceWrapper::GetWebData() { | 29 scoped_refptr<WebDataService> WebDataServiceWrapper::GetWebData() { |
| 30 return web_data_service_.get(); | 30 return web_data_service_.get(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 scoped_ptr<AutofillWebDataService> AutofillWebDataService::FromBrowserContext( | 34 scoped_refptr<AutofillWebDataService> |
| 35 content::BrowserContext* context) { | 35 AutofillWebDataService::FromBrowserContext(content::BrowserContext* context) { |
| 36 // For this service, the implicit/explicit distinction doesn't | 36 // For this service, the implicit/explicit distinction doesn't |
| 37 // really matter; it's just used for a DCHECK. So we currently | 37 // really matter; it's just used for a DCHECK. So we currently |
| 38 // cheat and always say EXPLICIT_ACCESS. | 38 // cheat and always say EXPLICIT_ACCESS. |
| 39 scoped_refptr<WebDataService> service = WebDataServiceFactory::GetForProfile( | 39 scoped_refptr<WebDataService> service = WebDataServiceFactory::GetForProfile( |
| 40 static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS); | 40 static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS); |
| 41 | 41 |
| 42 if (service.get()) { | 42 if (service.get()) { |
| 43 return scoped_ptr<AutofillWebDataService>( | 43 return scoped_refptr<AutofillWebDataService>( |
| 44 new AutofillWebDataServiceImpl(service)); | 44 new AutofillWebDataServiceImpl(service)); |
| 45 } else { | 45 } else { |
| 46 return scoped_ptr<AutofillWebDataService>(NULL); | 46 return scoped_refptr<AutofillWebDataService>(NULL); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 scoped_refptr<WebDataService> WebDataService::FromBrowserContext( | 51 scoped_refptr<WebDataService> WebDataService::FromBrowserContext( |
| 52 content::BrowserContext* context) { | 52 content::BrowserContext* context) { |
| 53 // For this service, the implicit/explicit distinction doesn't | 53 // For this service, the implicit/explicit distinction doesn't |
| 54 // really matter; it's just used for a DCHECK. So we currently | 54 // really matter; it's just used for a DCHECK. So we currently |
| 55 // cheat and always say EXPLICIT_ACCESS. | 55 // cheat and always say EXPLICIT_ACCESS. |
| 56 return WebDataServiceFactory::GetForProfile( | 56 return WebDataServiceFactory::GetForProfile( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 | 109 |
| 110 ProfileKeyedService* | 110 ProfileKeyedService* |
| 111 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const { | 111 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const { |
| 112 return new WebDataServiceWrapper(profile); | 112 return new WebDataServiceWrapper(profile); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { | 115 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| OLD | NEW |