OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 9 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 class CommandService; | 12 class CommandService; |
13 } | 13 } |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // Singleton that associate CommandService objects with Profiles. | 17 // Singleton that associate CommandService objects with Profiles. |
18 class CommandServiceFactory : public ProfileKeyedServiceFactory { | 18 class CommandServiceFactory : public ProfileKeyedServiceFactory { |
19 public: | 19 public: |
20 static CommandService* GetForProfile(Profile* profile); | 20 static CommandService* GetForProfile(Profile* profile); |
21 | 21 |
22 static CommandServiceFactory* GetInstance(); | 22 static CommandServiceFactory* GetInstance(); |
23 | 23 |
24 // Overridden from ProfileKeyedBaseFactory: | 24 // Overridden from ProfileKeyedBaseFactory: |
25 virtual bool ServiceIsCreatedWithProfile() OVERRIDE; | 25 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; |
26 | 26 |
27 private: | 27 private: |
28 friend struct DefaultSingletonTraits<CommandServiceFactory>; | 28 friend struct DefaultSingletonTraits<CommandServiceFactory>; |
29 | 29 |
30 CommandServiceFactory(); | 30 CommandServiceFactory(); |
31 virtual ~CommandServiceFactory(); | 31 virtual ~CommandServiceFactory(); |
32 | 32 |
33 // ProfileKeyedServiceFactory: | 33 // ProfileKeyedServiceFactory: |
34 virtual ProfileKeyedService* BuildServiceInstanceFor( | 34 virtual ProfileKeyedService* BuildServiceInstanceFor( |
35 Profile* profile) const OVERRIDE; | 35 Profile* profile) const OVERRIDE; |
36 virtual bool ServiceRedirectedInIncognito() OVERRIDE; | 36 virtual bool ServiceRedirectedInIncognito() const OVERRIDE; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(CommandServiceFactory); | 38 DISALLOW_COPY_AND_ASSIGN(CommandServiceFactory); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace extensions | 41 } // namespace extensions |
42 | 42 |
43 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ | 43 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_FACTORY_H_ |
OLD | NEW |