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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/credential_cache_service_factory_win.cc
diff --git a/chrome/browser/sync/credential_cache_service_factory_win.cc b/chrome/browser/sync/credential_cache_service_factory_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..98e836021599c7bf4f742e5687847114b543d801
--- /dev/null
+++ b/chrome/browser/sync/credential_cache_service_factory_win.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/credential_cache_service_factory_win.h"
+
+#include "base/memory/singleton.h"
+#include "base/win/windows_version.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/signin/token_service_factory.h"
+#include "chrome/browser/sync/credential_cache_service_win.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/common/chrome_paths_internal.h"
+
+
+namespace syncer {
+
+// static
+CredentialCacheServiceFactory* CredentialCacheServiceFactory::GetInstance() {
+ return Singleton<CredentialCacheServiceFactory>::get();
+}
+
+// static
+syncer::CredentialCacheService* CredentialCacheServiceFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<syncer::CredentialCacheService*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+CredentialCacheServiceFactory::CredentialCacheServiceFactory()
+ : ProfileKeyedServiceFactory("CredentialCacheService",
+ ProfileDependencyManager::GetInstance()) {
+ // TODO(rsimha): Uncomment this once it exists.
+ // DependsOn(PrefServiceFactory::GetInstance());
+ DependsOn(ProfileSyncServiceFactory::GetInstance());
+ DependsOn(TokenServiceFactory::GetInstance());
+}
+
+CredentialCacheServiceFactory::~CredentialCacheServiceFactory() {
+}
+
+// static
+bool CredentialCacheServiceFactory::IsDefaultProfile(Profile* profile) {
+ DCHECK(profile);
+ FilePath default_user_data_dir;
+ chrome::GetDefaultUserDataDirectory(&default_user_data_dir);
+ return profile->GetPath() ==
+ ProfileManager::GetDefaultProfileDir(default_user_data_dir);
+}
+
+bool CredentialCacheServiceFactory::ServiceIsCreatedWithProfile() {
+ return true;
+}
+
+ProfileKeyedService* CredentialCacheServiceFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ // Only instantiate a CredentialCacheService object if we are running in the
+ // default profile on Windows 8.
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ IsDefaultProfile(profile)) {
+ return new syncer::CredentialCacheService(profile);
+ }
+ return NULL;
+}
+
+} // namespace syncer
« 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