Chromium Code Reviews| 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_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "content/public/browser/notification_observer.h" | |
| 10 #include "content/public/browser/notification_registrar.h" | |
| 9 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
| 10 | 12 |
| 11 namespace base { | 13 namespace base { |
| 12 class DictionaryValue; | 14 class DictionaryValue; |
| 13 class ListValue; | 15 class ListValue; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace extensions { | 18 namespace extensions { |
| 17 class Command; | 19 class Command; |
| 18 class CommandService; | 20 class CommandService; |
| 19 } | 21 } |
| 20 | 22 |
| 21 class Extension; | 23 class Extension; |
| 22 | 24 |
| 23 namespace extensions { | 25 namespace extensions { |
| 24 | 26 |
| 25 // The handler page for the Extension Commands UI overlay. | 27 // The handler page for the Extension Commands UI overlay. |
| 26 class CommandHandler : public content::WebUIMessageHandler { | 28 class CommandHandler : public content::WebUIMessageHandler, |
| 29 public content::NotificationObserver { | |
| 27 public: | 30 public: |
| 28 CommandHandler(); | 31 CommandHandler(); |
| 29 virtual ~CommandHandler(); | 32 virtual ~CommandHandler(); |
| 30 | 33 |
| 31 // Fetches the localized values for the page and deposits them into | 34 // Fetches the localized values for the page and deposits them into |
| 32 // |localized_strings|. | 35 // |localized_strings|. |
| 33 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 36 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 34 | 37 |
| 35 // WebUIMessageHandler implementation. | 38 // WebUIMessageHandler implementation. |
| 36 virtual void RegisterMessages() OVERRIDE; | 39 virtual void RegisterMessages() OVERRIDE; |
| 37 | 40 |
| 41 // NotificationObserver implementation. | |
| 42 virtual void Observe(int type, const content::NotificationSource& source, | |
|
James Hawkins
2012/08/24 15:24:26
nit: Method declarations must have one parameter p
Yoyo Zhou
2012/08/24 16:00:40
Also, this can be private.
Finnur
2012/08/27 11:46:02
There was a discussion about this a few years back
| |
| 43 const content::NotificationDetails& details) OVERRIDE; | |
| 44 | |
| 38 private: | 45 private: |
| 39 // Update the list of extension commands in the config UI. | 46 // Update the list of extension commands in the config UI. |
| 40 void UpdateCommandDataOnPage(); | 47 void UpdateCommandDataOnPage(); |
| 41 | 48 |
| 42 // Handles requests from javascript to fetch the extensions data, including | 49 // Handles requests from javascript to fetch the extensions data, including |
| 43 // the commands it contains. | 50 // the commands it contains. |
| 44 // Replies back through: ExtensionCommandsOverlay.returnExtensionsData. | 51 // Replies back through: ExtensionCommandsOverlay.returnExtensionsData. |
| 45 void HandleRequestExtensionsData(const base::ListValue* args); | 52 void HandleRequestExtensionsData(const base::ListValue* args); |
| 46 | 53 |
| 47 // Handles requests from javascript to set a particular keyboard shortcut | 54 // Handles requests from javascript to set a particular keyboard shortcut |
| 48 // for a given extension command. | 55 // for a given extension command. |
| 49 void HandleSetExtensionCommandShortcut(const base::ListValue* args); | 56 void HandleSetExtensionCommandShortcut(const base::ListValue* args); |
| 50 | 57 |
| 51 // Handles requests from javascript to temporarily disable general Chrome | 58 // Handles requests from javascript to temporarily disable general Chrome |
| 52 // shortcut handling while the web page is capturing which shortcut to use. | 59 // shortcut handling while the web page is capturing which shortcut to use. |
| 53 void HandleSetShortcutHandlingSuspended(const base::ListValue* args); | 60 void HandleSetShortcutHandlingSuspended(const base::ListValue* args); |
| 54 | 61 |
| 55 // Fetches all known commands, active and inactive and returns them through | 62 // Fetches all known commands, active and inactive and returns them through |
| 56 // |commands|. | 63 // |commands|. |
| 57 void GetAllCommands(base::DictionaryValue* commands); | 64 void GetAllCommands(base::DictionaryValue* commands); |
| 58 | 65 |
| 66 // Used to observe notifications. | |
|
Yoyo Zhou
2012/08/24 16:00:40
nit: IMHO, unnecessary comment.
Finnur
2012/08/27 11:46:02
Removed.
Also, added Profile since trying to dec
| |
| 67 content::NotificationRegistrar registrar_; | |
| 68 | |
| 59 DISALLOW_COPY_AND_ASSIGN(CommandHandler); | 69 DISALLOW_COPY_AND_ASSIGN(CommandHandler); |
| 60 }; | 70 }; |
| 61 | 71 |
| 62 } // namespace extensions | 72 } // namespace extensions |
| 63 | 73 |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ | 74 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ |
| OLD | NEW |