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

Side by Side Diff: chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h

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, 10 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 #ifndef CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_
7 7
8 #include "content/public/browser/notification_observer.h" 8 #include "content/public/browser/user_metrics.h"
9 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/browser/web_ui_message_handler.h" 9 #include "content/public/browser/web_ui_message_handler.h"
11 10
12 // UI Handler for chrome://user-actions/ 11 // UI Handler for chrome://user-actions/
13 // It listens to user action notifications and passes those notifications 12 // It listens to user action notifications and passes those notifications
14 // into the Javascript to update the page. 13 // into the Javascript to update the page.
15 class UserActionsUIHandler : public content::NotificationObserver, 14 class UserActionsUIHandler : public content::WebUIMessageHandler {
16 public content::WebUIMessageHandler {
17 public: 15 public:
18 UserActionsUIHandler(); 16 UserActionsUIHandler();
19 virtual ~UserActionsUIHandler(); 17 virtual ~UserActionsUIHandler();
20 18
21 // NotificationObserver implementation:
22 // Listens for user action notifications and passes the message to
23 // observeUserAction in user_actions.js.
24 virtual void Observe(int type,
25 const content::NotificationSource& source,
26 const content::NotificationDetails& details) OVERRIDE;
27
28 // WebUIMessageHandler implementation: 19 // WebUIMessageHandler implementation:
29 // Does nothing for now. 20 // Does nothing for now.
30 virtual void RegisterMessages() OVERRIDE; 21 virtual void RegisterMessages() OVERRIDE;
31 22
32 private: 23 private:
33 content::NotificationRegistrar registrar_; 24 void OnUserAction(const std::string& action);
25
26 content::ActionCallback action_callback_;
34 27
35 DISALLOW_COPY_AND_ASSIGN(UserActionsUIHandler); 28 DISALLOW_COPY_AND_ASSIGN(UserActionsUIHandler);
36 }; 29 };
37 30
38 #endif // CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_ 31 #endif // CHROME_BROWSER_UI_WEBUI_USER_ACTIONS_USER_ACTIONS_UI_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698