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

Side by Side Diff: chrome/browser/sync/credential_cache_service_factory_win.cc

Issue 10656033: [sync] Automatic bootstrapping of Sync on Win 8 from cached credentials (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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
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/sync/credential_cache_service_factory_win.h"
6
7 #include "base/memory/singleton.h"
8 #include "base/win/windows_version.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_dependency_manager.h"
11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/signin/token_service_factory.h"
13 #include "chrome/browser/sync/credential_cache_service_win.h"
14 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/common/chrome_paths_internal.h"
16
17
18 namespace syncer {
19
20 // static
21 CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() {
22 return Singleton<CredentialCacheServiceFactory>::get();
23 }
24
25 // static
26 syncer::CredentialCacheService* CredentialCacheServiceFactory::GetForProfile(
27 Profile* profile) {
28 return static_cast<syncer::CredentialCacheService*>(
29 GetInstance()->GetServiceForProfile(profile, true));
30 }
31
32 CredentialCacheServiceFactory::CredentialCacheServiceFactory()
33 : ProfileKeyedServiceFactory("CredentialCacheService",
34 ProfileDependencyManager::GetInstance()) {
35 // TODO(rsimha): Uncomment this once it exists.
36 // DependsOn(PrefServiceFactory::GetInstance());
37 DependsOn(ProfileSyncServiceFactory::GetInstance());
38 DependsOn(TokenServiceFactory::GetInstance());
39 }
40
41 CredentialCacheServiceFactory::~CredentialCacheServiceFactory() {
42 }
43
44 // static
45 bool CredentialCacheServiceFactory::IsDefaultProfile(Profile* profile) {
46 DCHECK(profile);
47 FilePath default_user_data_dir;
48 chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
49 return profile->GetPath() ==
50 ProfileManager::GetDefaultProfileDir(default_user_data_dir);
51 }
52
53 bool CredentialCacheServiceFactory::ServiceIsCreatedWithProfile() {
54 return true;
55 }
56
57 ProfileKeyedService* CredentialCacheServiceFactory::BuildServiceInstanceFor(
58 Profile* profile) const {
59 // Only instantiate a CredentialCacheService object if we are running in the
60 // default profile on Windows 8.
61 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
62 IsDefaultProfile(profile)) {
63 return new syncer::CredentialCacheService(profile);
64 }
65 return NULL;
66 }
67
68 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/sync/credential_cache_service_factory_win.h ('k') | chrome/browser/sync/credential_cache_service_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698