Chromium Code Reviews| Index: chrome/browser/ui/webui/extensions/command_handler.cc |
| =================================================================== |
| --- chrome/browser/ui/webui/extensions/command_handler.cc (revision 153186) |
| +++ chrome/browser/ui/webui/extensions/command_handler.cc (working copy) |
| @@ -12,6 +12,8 @@ |
| #include "chrome/browser/extensions/extension_service.h" |
| #include "chrome/browser/extensions/extension_system.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/browser_finder.h" |
| +#include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/extensions/extension_manifest_constants.h" |
| #include "chrome/common/extensions/extension_set.h" |
| #include "content/public/browser/web_ui.h" |
| @@ -40,6 +42,13 @@ |
| } |
| void CommandHandler::RegisterMessages() { |
| + Browser* browser = browser::FindBrowserWithWebContents( |
| + web_ui()->GetWebContents()); |
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| + content::Source<Profile>(browser->profile())); |
| + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
|
Yoyo Zhou
2012/08/24 16:00:40
You wrote install/uninstall in the CL description,
Finnur
2012/08/27 11:46:02
Changed to load/unload.
On 2012/08/24 16:00:40, Y
|
| + content::Source<Profile>(browser->profile())); |
| + |
| web_ui()->RegisterMessageCallback("extensionCommandsRequestExtensionsData", |
| base::Bind(&CommandHandler::HandleRequestExtensionsData, |
| base::Unretained(this))); |
| @@ -51,6 +60,15 @@ |
| base::Unretained(this))); |
| } |
| +void CommandHandler::Observe( |
| + int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) { |
| + DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || |
| + type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED); |
| + UpdateCommandDataOnPage(); |
| +} |
| + |
| void CommandHandler::UpdateCommandDataOnPage() { |
| DictionaryValue results; |
| GetAllCommands(&results); |