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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 11 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
12 #include "chrome/common/extensions/command.h" | 12 #include "chrome/common/extensions/command.h" |
13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
14 #include "content/public/browser/notification_details.h" | 14 #include "content/public/browser/notification_details.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
18 | 18 |
19 class PrefServiceSyncable; | 19 class PrefRegistrySyncable; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class DictionaryValue; | 23 class DictionaryValue; |
24 } | 24 } |
25 | 25 |
26 namespace ui { | 26 namespace ui { |
27 class Accelerator; | 27 class Accelerator; |
28 } | 28 } |
29 | 29 |
30 namespace extensions { | 30 namespace extensions { |
31 | 31 |
32 // This service keeps track of preferences related to extension commands | 32 // This service keeps track of preferences related to extension commands |
33 // (assigning initial keybindings on install and removing them on deletion | 33 // (assigning initial keybindings on install and removing them on deletion |
34 // and answers questions related to which commands are active. | 34 // and answers questions related to which commands are active. |
35 class CommandService : public ProfileKeyedAPI, | 35 class CommandService : public ProfileKeyedAPI, |
36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
37 public: | 37 public: |
38 // An enum specifying whether to fetch all extension commands or only active | 38 // An enum specifying whether to fetch all extension commands or only active |
39 // ones. | 39 // ones. |
40 enum QueryType { | 40 enum QueryType { |
41 ALL, | 41 ALL, |
42 ACTIVE_ONLY, | 42 ACTIVE_ONLY, |
43 }; | 43 }; |
44 | 44 |
45 // Register prefs for keybinding. | 45 // Register prefs for keybinding. |
46 static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); | 46 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
47 | 47 |
48 // Constructs a CommandService object for the given profile. | 48 // Constructs a CommandService object for the given profile. |
49 explicit CommandService(Profile* profile); | 49 explicit CommandService(Profile* profile); |
50 virtual ~CommandService(); | 50 virtual ~CommandService(); |
51 | 51 |
52 // ProfileKeyedAPI implementation. | 52 // ProfileKeyedAPI implementation. |
53 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); | 53 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); |
54 | 54 |
55 // Convenience method to get the CommandService for a profile. | 55 // Convenience method to get the CommandService for a profile. |
56 static CommandService* Get(Profile* profile); | 56 static CommandService* Get(Profile* profile); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // A weak pointer to the profile we are associated with. Not owned by us. | 169 // A weak pointer to the profile we are associated with. Not owned by us. |
170 Profile* profile_; | 170 Profile* profile_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(CommandService); | 172 DISALLOW_COPY_AND_ASSIGN(CommandService); |
173 }; | 173 }; |
174 | 174 |
175 } // namespace extensions | 175 } // namespace extensions |
176 | 176 |
177 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ | 177 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ |
OLD | NEW |