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

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

Issue 10185008: Taking over issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/webdata/web_data_service_factory.h"
6
7 #include "base/file_path.h"
8 #include "chrome/browser/profiles/profile_dependency_manager.h"
9 #include "chrome/browser/webdata/web_data_service.h"
10 #include "chrome/common/chrome_constants.h"
11
12 WebDataServiceFactory::WebDataServiceFactory()
13 : RefcountedProfileKeyedServiceFactory(
14 "WebDataService",
15 ProfileDependencyManager::GetInstance()) {
16 // WebDataServiceFactory has no dependecies.
17 }
18
19 WebDataServiceFactory::~WebDataServiceFactory() {}
20
21 // static
22 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfile(
23 Profile* profile, Profile::ServiceAccessType access_type) {
24 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
25 return static_cast<WebDataService*>(
26 GetInstance()->GetServiceForProfile(profile, true).get());
27 }
28
29 // static
30 scoped_refptr<WebDataService> WebDataServiceFactory::GetForProfileIfExists(
31 Profile* profile, Profile::ServiceAccessType access_type) {
32 DCHECK(access_type != Profile::IMPLICIT_ACCESS || !profile->IsOffTheRecord());
33 return static_cast<WebDataService*>(
34 GetInstance()->GetServiceForProfile(profile, false).get());
35 }
36
37 // static
38 WebDataServiceFactory* WebDataServiceFactory::GetInstance() {
39 return Singleton<WebDataServiceFactory>::get();
40 }
41
42 bool WebDataServiceFactory::ServiceRedirectedInIncognito() {
43 return false;
44 }
45
46 scoped_refptr<RefcountedProfileKeyedService>
47 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const {
48 DCHECK(profile);
49
50 FilePath path = profile->GetPath();
51 path = path.Append(chrome::kWebDataFilename);
52
53 scoped_refptr<WebDataService> wds(new WebDataService());
54 if (!wds->Init(profile->GetPath()))
55 NOTREACHED();
56 return wds.get();
57 }
58
59 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() {
60 return true;
61 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service_factory.h ('k') | chrome/browser/webdata/web_data_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698