1// Copyright (c) 2012 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_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_FACTORY_H_
6#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_FACTORY_H_
7
8#include "base/memory/singleton.h"
9#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
10
11class Profile;
12
13namespace file_manager {
14
15class EventRouter;
16
17class EventRouterFactory : public BrowserContextKeyedServiceFactory {
18 public:
19  // Returns the EventRouter for |profile|, creating it if
20  // it is not yet created.
21  static EventRouter* GetForProfile(Profile* profile);
22
23  // Returns the EventRouterFactory instance.
24  static EventRouterFactory* GetInstance();
25
26 protected:
27  // BrowserContextKeyedBaseFactory overrides:
28  virtual content::BrowserContext* GetBrowserContextToUse(
29      content::BrowserContext* context) const OVERRIDE;
30  virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
31  virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
32
33 private:
34  friend struct DefaultSingletonTraits<EventRouterFactory>;
35
36  EventRouterFactory();
37  virtual ~EventRouterFactory();
38
39  // BrowserContextKeyedServiceFactory:
40  virtual KeyedService* BuildServiceInstanceFor(
41      content::BrowserContext* context) const OVERRIDE;
42};
43
44}  // namespace file_manager
45
46#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_FACTORY_H_
47