summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/signin/cookie_reminter_factory.cc
blob: f53de57d249926c91f6262931795751bb227b380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2019 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/cookie_reminter_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/signin/core/browser/cookie_reminter.h"

CookieReminterFactory::CookieReminterFactory()
    : BrowserContextKeyedServiceFactory(
          "CookieReminter",
          BrowserContextDependencyManager::GetInstance()) {
  DependsOn(IdentityManagerFactory::GetInstance());
}

CookieReminterFactory::~CookieReminterFactory() {}

// static
CookieReminter* CookieReminterFactory::GetForProfile(Profile* profile) {
  return static_cast<CookieReminter*>(
      GetInstance()->GetServiceForBrowserContext(profile, true));
}

// static
CookieReminterFactory* CookieReminterFactory::GetInstance() {
  return base::Singleton<CookieReminterFactory>::get();
}

KeyedService* CookieReminterFactory::BuildServiceInstanceFor(
    content::BrowserContext* context) const {
  Profile* profile = Profile::FromBrowserContext(context);
  signin::IdentityManager* identity_manager =
      IdentityManagerFactory::GetForProfile(profile);
  return new CookieReminter(identity_manager);
}