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

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

Issue 10956034: Switching from ForXyz naming to FromXyz naming, for consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/file_path.h" 7 #include "base/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/browser/webdata/web_data_service.h" 10 #include "chrome/browser/webdata/web_data_service.h"
11 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
12 12
13 // static 13 // static
14 scoped_ptr<AutofillWebDataService> AutofillWebDataService::ForContext( 14 scoped_ptr<AutofillWebDataService> AutofillWebDataService::FromBrowserContext(
15 content::BrowserContext* context) { 15 content::BrowserContext* context) {
16 // For this service, the implicit/explicit distinction doesn't 16 // For this service, the implicit/explicit distinction doesn't
17 // really matter; it's just used for a DCHECK. So we currently 17 // really matter; it's just used for a DCHECK. So we currently
18 // cheat and always say EXPLICIT_ACCESS. 18 // cheat and always say EXPLICIT_ACCESS.
19 scoped_refptr<WebDataService> service = WebDataServiceFactory::GetForProfile( 19 scoped_refptr<WebDataService> service = WebDataServiceFactory::GetForProfile(
20 static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS); 20 static_cast<Profile*>(context), Profile::EXPLICIT_ACCESS);
21 21
22 if (service.get()) { 22 if (service.get()) {
23 return scoped_ptr<AutofillWebDataService>( 23 return scoped_ptr<AutofillWebDataService>(
24 new AutofillWebDataServiceImpl(service)); 24 new AutofillWebDataServiceImpl(service));
25 } else { 25 } else {
26 return scoped_ptr<AutofillWebDataService>(NULL); 26 return scoped_ptr<AutofillWebDataService>(NULL);
27 } 27 }
28 } 28 }
29 29
30 WebDataServiceFactory::WebDataServiceFactory() 30 WebDataServiceFactory::WebDataServiceFactory()
31 : RefcountedProfileKeyedServiceFactory( 31 : RefcountedProfileKeyedServiceFactory(
32 "WebDataService", 32 "WebDataService",
33 ProfileDependencyManager::GetInstance()) { 33 ProfileDependencyManager::GetInstance()) {
34 // WebDataServiceFactory has no dependecies. 34 // WebDataServiceFactory has no dependecies.
35 } 35 }
36 36
37 WebDataServiceFactory::~WebDataServiceFactory() {} 37 WebDataServiceFactory::~WebDataServiceFactory() {}
38 38
39 // static 39 // static
40 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfile( 40 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfile(
41 Profile* profile, Profile::ServiceAccessType access_type) { 41 Profile* profile, Profile::ServiceAccessType access_type) {
42 // If |access_type| starts being used for anything other than this 42 // If |access_type| starts being used for anything other than this
43 // DCHECK, we need to start taking it as a parameter to 43 // DCHECK, we need to start taking it as a parameter to
44 // AutofillWebDataServiceImpl::ForContext (see above). 44 // AutofillWebDataServiceImpl::FromBrowserContext (see above).
45 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); 45 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
46 return static_cast<WebDataService*>( 46 return static_cast<WebDataService*>(
47 GetInstance()->GetServiceForProfile(profile, true).get()); 47 GetInstance()->GetServiceForProfile(profile, true).get());
48 } 48 }
49 49
50 // static 50 // static
51 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfileIfExists( 51 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfileIfExists(
52 Profile* profile, Profile::ServiceAccessType access_type) { 52 Profile* profile, Profile::ServiceAccessType access_type) {
53 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord()); 53 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
54 return static_cast<WebDataService*>( 54 return static_cast<WebDataService*>(
(...skipping 18 matching lines...) Expand all
73 73
74 scoped_refptr<WebDataService> wds(new WebDataService()); 74 scoped_refptr<WebDataService> wds(new WebDataService());
75 if (!wds->Init(profile->GetPath())) 75 if (!wds->Init(profile->GetPath()))
76 NOTREACHED(); 76 NOTREACHED();
77 return wds.get(); 77 return wds.get();
78 } 78 }
79 79
80 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { 80 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const {
81 return true; 81 return true;
82 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698