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" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Constructs a CommandService object for the given profile. | 60 // Constructs a CommandService object for the given profile. |
61 explicit CommandService(Profile* profile); | 61 explicit CommandService(Profile* profile); |
62 virtual ~CommandService(); | 62 virtual ~CommandService(); |
63 | 63 |
64 // ProfileKeyedAPI implementation. | 64 // ProfileKeyedAPI implementation. |
65 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); | 65 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); |
66 | 66 |
67 // Convenience method to get the CommandService for a profile. | 67 // Convenience method to get the CommandService for a profile. |
68 static CommandService* Get(Profile* profile); | 68 static CommandService* Get(Profile* profile); |
69 | 69 |
| 70 // Return true if the specified accelerator is one of the following multimedia |
| 71 // keys: Next Track key, Previous Track key, Stop Media key, Play/Pause Media |
| 72 // key, without any modifiers. |
| 73 static bool IsMediaKey(const ui::Accelerator& accelerator); |
| 74 |
70 // Gets the command (if any) for the browser action of an extension given | 75 // Gets the command (if any) for the browser action of an extension given |
71 // its |extension_id|. The function consults the master list to see if | 76 // its |extension_id|. The function consults the master list to see if |
72 // the command is active. Returns false if the extension has no browser | 77 // the command is active. Returns false if the extension has no browser |
73 // action. Returns false if the command is not active and |type| requested | 78 // action. Returns false if the command is not active and |type| requested |
74 // is ACTIVE_ONLY. |command| contains the command found and |active| (if not | 79 // is ACTIVE_ONLY. |command| contains the command found and |active| (if not |
75 // NULL) contains whether |command| is active. | 80 // NULL) contains whether |command| is active. |
76 bool GetBrowserActionCommand(const std::string& extension_id, | 81 bool GetBrowserActionCommand(const std::string& extension_id, |
77 QueryType type, | 82 QueryType type, |
78 extensions::Command* command, | 83 extensions::Command* command, |
79 bool* active); | 84 bool* active); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 197 |
193 DISALLOW_COPY_AND_ASSIGN(CommandService); | 198 DISALLOW_COPY_AND_ASSIGN(CommandService); |
194 }; | 199 }; |
195 | 200 |
196 template <> | 201 template <> |
197 void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); | 202 void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); |
198 | 203 |
199 } // namespace extensions | 204 } // namespace extensions |
200 | 205 |
201 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ | 206 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ |
OLD | NEW |