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