blob: 51d50f2d13409657e93cc5747186f04c96fc0fe7 [file] [log] [blame]
[email protected]4b7111f22013-06-18 14:22:121// Copyright 2013 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#ifndef APPS_APP_LIFETIME_MONITOR_FACTORY_H_
6#define APPS_APP_LIFETIME_MONITOR_FACTORY_H_
7
8#include "base/memory/singleton.h"
[email protected]12b7af32014-03-13 05:28:209#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
[email protected]4b7111f22013-06-18 14:22:1210
michaelpg4d80e562017-04-04 01:48:1411namespace content {
12class BrowserContext;
13}
[email protected]4b7111f22013-06-18 14:22:1214
15namespace apps {
16
17class AppLifetimeMonitor;
18
19// Singleton that owns all AppLifetimeMonitors and associates them with
michaelpg4d80e562017-04-04 01:48:1420// BrowserContexts. Listens for the BrowserContext's destruction notification
21// and cleans up the associated AppLifetimeMonitor.
[email protected]4b7111f22013-06-18 14:22:1222class AppLifetimeMonitorFactory : public BrowserContextKeyedServiceFactory {
23 public:
michaelpg4d80e562017-04-04 01:48:1424 static AppLifetimeMonitor* GetForBrowserContext(
25 content::BrowserContext* context);
[email protected]4b7111f22013-06-18 14:22:1226
27 static AppLifetimeMonitorFactory* GetInstance();
28
29 private:
olli.raula36aa8be2015-09-10 11:14:2230 friend struct base::DefaultSingletonTraits<AppLifetimeMonitorFactory>;
[email protected]4b7111f22013-06-18 14:22:1231
32 AppLifetimeMonitorFactory();
dcheng2f5be412014-10-22 01:46:0833 ~AppLifetimeMonitorFactory() override;
[email protected]4b7111f22013-06-18 14:22:1234
35 // BrowserContextKeyedServiceFactory:
dcheng2f5be412014-10-22 01:46:0836 KeyedService* BuildServiceInstanceFor(
michaelpg4d80e562017-04-04 01:48:1437 content::BrowserContext* context) const override;
dcheng2f5be412014-10-22 01:46:0838 bool ServiceIsCreatedWithBrowserContext() const override;
39 content::BrowserContext* GetBrowserContextToUse(
40 content::BrowserContext* context) const override;
[email protected]4b7111f22013-06-18 14:22:1241};
42
43} // namespace apps
44
45#endif // APPS_APP_LIFETIME_MONITOR_FACTORY_H_