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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h" 5 #include "chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h"
6 6
7 #include "base/logging.h"
8 #include "base/values.h" 7 #include "base/values.h"
9 #include "content/public/browser/notification_details.h"
10 #include "content/public/browser/notification_service.h"
11 #include "content/public/browser/notification_source.h"
12 #include "content/public/browser/notification_types.h"
13 #include "content/public/browser/web_ui.h" 8 #include "content/public/browser/web_ui.h"
14 9
15 UserActionsUIHandler::UserActionsUIHandler() : NotificationObserver() { 10 UserActionsUIHandler::UserActionsUIHandler() {
16 registrar_.Add(this,
17 content::NOTIFICATION_USER_ACTION,
18 content::NotificationService::AllSources());
19 } 11 }
20 12
21 UserActionsUIHandler::~UserActionsUIHandler() { 13 UserActionsUIHandler::~UserActionsUIHandler() {
22 } 14 }
23 15
24 void UserActionsUIHandler::Observe( 16 void UserActionsUIHandler::UserAction(const std::string& action) {
25 int type, 17 base::StringValue user_action_name(action);
26 const content::NotificationSource& source,
27 const content::NotificationDetails& details) {
28 DCHECK_EQ(type, content::NOTIFICATION_USER_ACTION);
29 base::StringValue user_action_name(
30 *content::Details<const char*>(details).ptr());
31 web_ui()->CallJavascriptFunction("userActions.observeUserAction", 18 web_ui()->CallJavascriptFunction("userActions.observeUserAction",
32 user_action_name); 19 user_action_name);
33 } 20 }
34 21
35 void UserActionsUIHandler::RegisterMessages() {} 22 void UserActionsUIHandler::RegisterMessages() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698