OLD | NEW |
| (Empty) |
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_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | |
7 | |
8 #include "base/memory/singleton.h" | |
9 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | |
10 | |
11 namespace extensions { | |
12 class CommandService; | |
13 } | |
14 | |
15 namespace extensions { | |
16 | |
17 // Singleton that associate CommandService objects with Profiles. | |
18 class CommandServiceFactory : public ProfileKeyedServiceFactory { | |
19 public: | |
20 static CommandService* GetForProfile(Profile* profile); | |
21 | |
22 static CommandServiceFactory* GetInstance(); | |
23 | |
24 // Overridden from ProfileKeyedBaseFactory: | |
25 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; | |
26 | |
27 private: | |
28 friend struct DefaultSingletonTraits<CommandServiceFactory>; | |
29 | |
30 CommandServiceFactory(); | |
31 virtual ~CommandServiceFactory(); | |
32 | |
33 // ProfileKeyedServiceFactory: | |
34 virtual ProfileKeyedService* BuildServiceInstanceFor( | |
35 Profile* profile) const OVERRIDE; | |
36 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(CommandServiceFactory); | |
39 }; | |
40 | |
41 } // namespace extensions | |
42 | |
43 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | |
OLD | NEW |