| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Constructs a CommandService object for the given profile. | 71 // Constructs a CommandService object for the given profile. |
| 72 explicit CommandService(content::BrowserContext* context); | 72 explicit CommandService(content::BrowserContext* context); |
| 73 virtual ~CommandService(); | 73 virtual ~CommandService(); |
| 74 | 74 |
| 75 // ProfileKeyedAPI implementation. | 75 // ProfileKeyedAPI implementation. |
| 76 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); | 76 static ProfileKeyedAPIFactory<CommandService>* GetFactoryInstance(); |
| 77 | 77 |
| 78 // Convenience method to get the CommandService for a profile. | 78 // Convenience method to get the CommandService for a profile. |
| 79 static CommandService* Get(content::BrowserContext* context); | 79 static CommandService* Get(content::BrowserContext* context); |
| 80 | 80 |
| 81 // Return true if the specified accelerator is one of the following multimedia | |
| 82 // keys: Next Track key, Previous Track key, Stop Media key, Play/Pause Media | |
| 83 // key, without any modifiers. | |
| 84 static bool IsMediaKey(const ui::Accelerator& accelerator); | |
| 85 | |
| 86 // Returns true if |extension| is permitted to and does remove the bookmark | 81 // Returns true if |extension| is permitted to and does remove the bookmark |
| 87 // shortcut key. | 82 // shortcut key. |
| 88 static bool RemovesBookmarkShortcut(const extensions::Extension* extension); | 83 static bool RemovesBookmarkShortcut(const extensions::Extension* extension); |
| 89 | 84 |
| 90 // Gets the command (if any) for the browser action of an extension given | 85 // Gets the command (if any) for the browser action of an extension given |
| 91 // its |extension_id|. The function consults the master list to see if | 86 // its |extension_id|. The function consults the master list to see if |
| 92 // the command is active. Returns false if the extension has no browser | 87 // the command is active. Returns false if the extension has no browser |
| 93 // action. Returns false if the command is not active and |type| requested | 88 // action. Returns false if the command is not active and |type| requested |
| 94 // is ACTIVE_ONLY. |command| contains the command found and |active| (if not | 89 // is ACTIVE_ONLY. |command| contains the command found and |active| (if not |
| 95 // NULL) contains whether |command| is active. | 90 // NULL) contains whether |command| is active. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 201 |
| 207 DISALLOW_COPY_AND_ASSIGN(CommandService); | 202 DISALLOW_COPY_AND_ASSIGN(CommandService); |
| 208 }; | 203 }; |
| 209 | 204 |
| 210 template <> | 205 template <> |
| 211 void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); | 206 void ProfileKeyedAPIFactory<CommandService>::DeclareFactoryDependencies(); |
| 212 | 207 |
| 213 } // namespace extensions | 208 } // namespace extensions |
| 214 | 209 |
| 215 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ | 210 #endif // CHROME_BROWSER_EXTENSIONS_API_COMMANDS_COMMAND_SERVICE_H_ |
| OLD | NEW |