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