Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / webui / extensions / command_handler.h
blobc2f557385703450a05fc6de5dd0c0f6112d1e391
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/notification_observer.h"
10 #include "content/public/browser/notification_registrar.h"
11 #include "content/public/browser/web_ui_message_handler.h"
13 namespace base {
14 class DictionaryValue;
15 class ListValue;
18 namespace content {
19 class WebUIDataSource;
22 namespace extensions {
23 class Command;
24 class CommandService;
27 class Extension;
28 class Profile;
30 namespace extensions {
32 // The handler page for the Extension Commands UI overlay.
33 class CommandHandler : public content::WebUIMessageHandler,
34 public content::NotificationObserver {
35 public:
36 explicit CommandHandler(Profile* profile);
37 virtual ~CommandHandler();
39 // Fetches the localized values for the page and deposits them into |source|.
40 void GetLocalizedValues(content::WebUIDataSource* source);
42 // WebUIMessageHandler implementation.
43 virtual void RegisterMessages() OVERRIDE;
45 // NotificationObserver implementation.
46 virtual void Observe(int type,
47 const content::NotificationSource& source,
48 const content::NotificationDetails& details) OVERRIDE;
50 private:
51 // Update the list of extension commands in the config UI.
52 void UpdateCommandDataOnPage();
54 // Handles requests from javascript to fetch the extensions data, including
55 // the commands it contains.
56 // Replies back through: ExtensionCommandsOverlay.returnExtensionsData.
57 void HandleRequestExtensionsData(const base::ListValue* args);
59 // Handles requests from javascript to set a particular keyboard shortcut
60 // for a given extension command.
61 void HandleSetExtensionCommandShortcut(const base::ListValue* args);
63 // Handles requests from javascript to change the scope of a particular
64 // keyboard shortcut for a given extension command.
65 void HandleSetCommandScope(const base::ListValue* args);
67 // Handles requests from javascript to temporarily disable general Chrome
68 // shortcut handling while the web page is capturing which shortcut to use.
69 void HandleSetShortcutHandlingSuspended(const base::ListValue* args);
71 // Fetches all known commands, active and inactive and returns them through
72 // |commands|.
73 void GetAllCommands(base::DictionaryValue* commands);
75 content::NotificationRegistrar registrar_;
77 Profile* profile_;
79 DISALLOW_COPY_AND_ASSIGN(CommandHandler);
82 } // namespace extensions
84 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_