Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/ui/webui/extensions/command_handler.h

Issue 10870068: Make sure the Commands list correctly reflects the status of extensions right after install/uninsta… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/command_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
24 class Profile;
22 25
23 namespace extensions { 26 namespace extensions {
24 27
25 // The handler page for the Extension Commands UI overlay. 28 // The handler page for the Extension Commands UI overlay.
26 class CommandHandler : public content::WebUIMessageHandler { 29 class CommandHandler : public content::WebUIMessageHandler,
30 public content::NotificationObserver {
27 public: 31 public:
28 CommandHandler(); 32 explicit CommandHandler(Profile* profile);
29 virtual ~CommandHandler(); 33 virtual ~CommandHandler();
30 34
31 // Fetches the localized values for the page and deposits them into 35 // Fetches the localized values for the page and deposits them into
32 // |localized_strings|. 36 // |localized_strings|.
33 void GetLocalizedValues(base::DictionaryValue* localized_strings); 37 void GetLocalizedValues(base::DictionaryValue* localized_strings);
34 38
35 // WebUIMessageHandler implementation. 39 // WebUIMessageHandler implementation.
36 virtual void RegisterMessages() OVERRIDE; 40 virtual void RegisterMessages() OVERRIDE;
37 41
42 // NotificationObserver implementation.
43 virtual void Observe(int type,
44 const content::NotificationSource& source,
45 const content::NotificationDetails& details) OVERRIDE;
46
38 private: 47 private:
39 // Update the list of extension commands in the config UI. 48 // Update the list of extension commands in the config UI.
40 void UpdateCommandDataOnPage(); 49 void UpdateCommandDataOnPage();
41 50
42 // Handles requests from javascript to fetch the extensions data, including 51 // Handles requests from javascript to fetch the extensions data, including
43 // the commands it contains. 52 // the commands it contains.
44 // Replies back through: ExtensionCommandsOverlay.returnExtensionsData. 53 // Replies back through: ExtensionCommandsOverlay.returnExtensionsData.
45 void HandleRequestExtensionsData(const base::ListValue* args); 54 void HandleRequestExtensionsData(const base::ListValue* args);
46 55
47 // Handles requests from javascript to set a particular keyboard shortcut 56 // Handles requests from javascript to set a particular keyboard shortcut
48 // for a given extension command. 57 // for a given extension command.
49 void HandleSetExtensionCommandShortcut(const base::ListValue* args); 58 void HandleSetExtensionCommandShortcut(const base::ListValue* args);
50 59
51 // Handles requests from javascript to temporarily disable general Chrome 60 // Handles requests from javascript to temporarily disable general Chrome
52 // shortcut handling while the web page is capturing which shortcut to use. 61 // shortcut handling while the web page is capturing which shortcut to use.
53 void HandleSetShortcutHandlingSuspended(const base::ListValue* args); 62 void HandleSetShortcutHandlingSuspended(const base::ListValue* args);
54 63
55 // Fetches all known commands, active and inactive and returns them through 64 // Fetches all known commands, active and inactive and returns them through
56 // |commands|. 65 // |commands|.
57 void GetAllCommands(base::DictionaryValue* commands); 66 void GetAllCommands(base::DictionaryValue* commands);
58 67
68 content::NotificationRegistrar registrar_;
69
70 Profile* profile_;
71
59 DISALLOW_COPY_AND_ASSIGN(CommandHandler); 72 DISALLOW_COPY_AND_ASSIGN(CommandHandler);
60 }; 73 };
61 74
62 } // namespace extensions 75 } // namespace extensions
63 76
64 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_ 77 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_COMMAND_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/command_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698