1// 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 CHROME_BROWSER_POLICY_CLOUD_POLICY_HEADER_SERVICE_FACTORY_H_
6#define CHROME_BROWSER_POLICY_CLOUD_POLICY_HEADER_SERVICE_FACTORY_H_
7
8#include "base/memory/singleton.h"
9#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
10
11namespace policy {
12
13class PolicyHeaderService;
14
15// Factory for PolicyHeaderService objects. PolicyHeaderService is not actually
16// a KeyedService, so this class wraps PolicyHeaderService in
17// a KeyedService internally.
18class PolicyHeaderServiceFactory : public BrowserContextKeyedServiceFactory {
19 public:
20  // Returns the instance of PolicyHeaderService for the passed |context|, or
21  // NULL if there is none (for instance, for incognito windows).
22  static PolicyHeaderService* GetForBrowserContext(
23      content::BrowserContext* context);
24
25  // Returns an instance of the PolicyHeaderServiceFactory singleton.
26  static PolicyHeaderServiceFactory* GetInstance();
27
28 protected:
29  // BrowserContextKeyedServiceFactory implementation.
30  virtual KeyedService* BuildServiceInstanceFor(
31      content::BrowserContext* profile) const OVERRIDE;
32
33 private:
34  friend struct DefaultSingletonTraits<PolicyHeaderServiceFactory>;
35
36  PolicyHeaderServiceFactory();
37  virtual ~PolicyHeaderServiceFactory();
38
39  DISALLOW_COPY_AND_ASSIGN(PolicyHeaderServiceFactory);
40};
41
42}  // namespace policy
43
44#endif  // CHROME_BROWSER_POLICY_CLOUD_POLICY_HEADER_SERVICE_FACTORY_H_
45