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

Unified Diff: chrome/browser/signin/cross_device_promo_factory.cc

Issue 1087933002: Cross Device Promo - Main Eligibility Flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build.gn Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/cross_device_promo_factory.cc
diff --git a/chrome/browser/signin/cross_device_promo_factory.cc b/chrome/browser/signin/cross_device_promo_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4ff53b36818a6500e8fa539eb276c7ee8f851fab
--- /dev/null
+++ b/chrome/browser/signin/cross_device_promo_factory.cc
@@ -0,0 +1,66 @@
+// Copyright 2015 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/signin/cross_device_promo_factory.h"
+
+#include "base/prefs/pref_service.h"
+#include "chrome/browser/prefs/pref_service_syncable.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/chrome_signin_client_factory.h"
+#include "chrome/browser/signin/cross_device_promo.h"
+#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/common/pref_names.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/signin/core/browser/signin_manager.h"
+#include "google_apis/gaia/gaia_constants.h"
+
+CrossDevicePromoFactory::CrossDevicePromoFactory()
+ : BrowserContextKeyedServiceFactory(
+ "CrossDevicePromo",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(ChromeSigninClientFactory::GetInstance());
+ DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
+ DependsOn(SigninManagerFactory::GetInstance());
+}
+
+CrossDevicePromoFactory::~CrossDevicePromoFactory() {
+}
+
+// static
+CrossDevicePromo* CrossDevicePromoFactory::GetForProfile(Profile* profile) {
+ return static_cast<CrossDevicePromo*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+CrossDevicePromoFactory* CrossDevicePromoFactory::GetInstance() {
+ return Singleton<CrossDevicePromoFactory>::get();
+}
+
+void CrossDevicePromoFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* user_prefs) {
+ user_prefs->RegisterBooleanPref(prefs::kCrossDevicePromoOptedOut, false);
+ user_prefs->RegisterBooleanPref(prefs::kCrossDevicePromoActive, false);
+ user_prefs->RegisterInt64Pref(
+ prefs::kCrossDevicePromoObservedSingleAccountCookie,
+ base::Time::Time().ToInternalValue());
+ user_prefs->RegisterInt64Pref(
+ prefs::kCrossDevicePromoNextFetchListDevicesTime,
+ base::Time::Time().ToInternalValue());
+ user_prefs->RegisterIntegerPref(prefs::kCrossDevicePromoNumDevices, 0);
+ user_prefs->RegisterInt64Pref(prefs::kCrossDevicePromoLastDeviceActiveTime,
+ base::Time::Time().ToInternalValue());
+}
+
+KeyedService* CrossDevicePromoFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+ CrossDevicePromo* service = new CrossDevicePromo(
+ SigninManagerFactory::GetForProfile(profile),
+ GaiaCookieManagerServiceFactory::GetForProfile(profile),
+ ChromeSigninClientFactory::GetForProfile(profile), profile->GetPrefs());
+ return service;
+}
« no previous file with comments | « chrome/browser/signin/cross_device_promo_factory.h ('k') | chrome/browser/signin/cross_device_promo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698