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

Unified Diff: chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc

Issue 12039079: content: convert user action notification to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 11 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/user_actions/user_actions_ui_handler.cc
diff --git a/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc b/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
index fa5f956bc2272cbd8cfc7e5119ae51f62535d9ee..3cf23fcce70e0275f8adcd611d1adaf7b9525081 100644
--- a/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
+++ b/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
@@ -4,32 +4,25 @@
#include "chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h"
-#include "base/logging.h"
+#include "base/bind.h"
#include "base/values.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_ui.h"
-UserActionsUIHandler::UserActionsUIHandler() : NotificationObserver() {
- registrar_.Add(this,
- content::NOTIFICATION_USER_ACTION,
- content::NotificationService::AllSources());
+UserActionsUIHandler::UserActionsUIHandler()
+ : action_callback_(base::Bind(&UserActionsUIHandler::OnUserAction,
+ base::Unretained(this))) {
+ content::AddActionCallback(action_callback_);
}
UserActionsUIHandler::~UserActionsUIHandler() {
+ content::RemoveActionCallback(action_callback_);
}
-void UserActionsUIHandler::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(type, content::NOTIFICATION_USER_ACTION);
- base::StringValue user_action_name(
- *content::Details<const char*>(details).ptr());
+void UserActionsUIHandler::RegisterMessages() {}
+
+void UserActionsUIHandler::OnUserAction(const std::string& action) {
+ base::StringValue user_action_name(action);
web_ui()->CallJavascriptFunction("userActions.observeUserAction",
user_action_name);
}
-void UserActionsUIHandler::RegisterMessages() {}

Powered by Google App Engine
This is Rietveld 408576698