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

Side by Side 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: rogers nit and a signed variable type so mac compiles 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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/signin/cross_device_promo_factory.h"
6
7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/prefs/pref_service_syncable.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/chrome_signin_client_factory.h"
11 #include "chrome/browser/signin/cross_device_promo.h"
12 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/common/pref_names.h"
15 #include "components/keyed_service/content/browser_context_dependency_manager.h"
16 #include "components/pref_registry/pref_registry_syncable.h"
17 #include "components/signin/core/browser/signin_manager.h"
18 #include "google_apis/gaia/gaia_constants.h"
19
20 CrossDevicePromoFactory::CrossDevicePromoFactory()
21 : BrowserContextKeyedServiceFactory(
22 "CrossDevicePromo",
23 BrowserContextDependencyManager::GetInstance()) {
24 DependsOn(ChromeSigninClientFactory::GetInstance());
25 DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
26 DependsOn(SigninManagerFactory::GetInstance());
27 }
28
29 CrossDevicePromoFactory::~CrossDevicePromoFactory() {}
30
31 // static
32 CrossDevicePromo* CrossDevicePromoFactory::GetForProfile(Profile* profile) {
33 return static_cast<CrossDevicePromo*>(
34 GetInstance()->GetServiceForBrowserContext(profile, true));
35 }
36
37 // static
38 CrossDevicePromoFactory* CrossDevicePromoFactory::GetInstance() {
39 return Singleton<CrossDevicePromoFactory>::get();
40 }
41
42 void CrossDevicePromoFactory::RegisterProfilePrefs(
43 user_prefs::PrefRegistrySyncable* user_prefs) {
44 user_prefs->RegisterBooleanPref(prefs::kCrossDevicePromoOptedOut, false);
45 user_prefs->RegisterBooleanPref(prefs::kCrossDevicePromoActive, false);
46 user_prefs->RegisterInt64Pref(
47 prefs::kCrossDevicePromoObservedSingleAccountCookie,
48 base::Time::Time().ToInternalValue());
49 user_prefs->RegisterInt64Pref(
50 prefs::kCrossDevicePromoNextFetchListDevicesTime,
51 base::Time::Time().ToInternalValue());
52 user_prefs->RegisterIntegerPref(prefs::kCrossDevicePromoNumDevices, 0);
53 user_prefs->RegisterInt64Pref(prefs::kCrossDevicePromoLastDeviceActiveTime,
54 base::Time::Time().ToInternalValue());
55 }
56
57 KeyedService* CrossDevicePromoFactory::BuildServiceInstanceFor(
58 content::BrowserContext* context) const {
59 Profile* profile = Profile::FromBrowserContext(context);
60 CrossDevicePromo* service = new CrossDevicePromo(
61 SigninManagerFactory::GetForProfile(profile),
62 GaiaCookieManagerServiceFactory::GetForProfile(profile),
63 ChromeSigninClientFactory::GetForProfile(profile),
64 profile->GetPrefs());
65 return service;
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698