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

Unified Diff: chrome/browser/ui/webui/extensions/command_handler.cc

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, 4 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 side-by-side diff with in-line comments
Download patch
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,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.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"
@@ -20,7 +21,7 @@
namespace extensions {
-CommandHandler::CommandHandler() {
+CommandHandler::CommandHandler(Profile* profile) : profile_(profile) {
}
CommandHandler::~CommandHandler() {
@@ -40,6 +41,11 @@
}
void CommandHandler::RegisterMessages() {
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile_));
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_));
+
web_ui()->RegisterMessageCallback("extensionCommandsRequestExtensionsData",
base::Bind(&CommandHandler::HandleRequestExtensionsData,
base::Unretained(this)));
@@ -51,6 +57,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_UNLOADED);
+ UpdateCommandDataOnPage();
+}
+
void CommandHandler::UpdateCommandDataOnPage() {
DictionaryValue results;
GetAllCommands(&results);
« no previous file with comments | « chrome/browser/ui/webui/extensions/command_handler.h ('k') | chrome/browser/ui/webui/extensions/extensions_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698