| OLD | NEW |
| 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::UserMetricsObserver, |
| 16 public content::WebUIMessageHandler { | 15 public content::WebUIMessageHandler { |
| 17 public: | 16 public: |
| 18 UserActionsUIHandler(); | 17 UserActionsUIHandler(); |
| 19 virtual ~UserActionsUIHandler(); | 18 virtual ~UserActionsUIHandler(); |
| 20 | 19 |
| 21 // NotificationObserver implementation: | 20 // content::UserMetricsObserver implementation: |
| 22 // Listens for user action notifications and passes the message to | 21 virtual void UserAction(const std::string& action) OVERRIDE; |
| 23 // observeUserAction in user_actions.js. | |
| 24 virtual void Observe(int type, | |
| 25 const content::NotificationSource& source, | |
| 26 const content::NotificationDetails& details) OVERRIDE; | |
| 27 | 22 |
| 28 // WebUIMessageHandler implementation: | 23 // WebUIMessageHandler implementation: |
| 29 // Does nothing for now. | 24 // Does nothing for now. |
| 30 virtual void RegisterMessages() OVERRIDE; | 25 virtual void RegisterMessages() OVERRIDE; |
| 31 | 26 |
| 32 private: | 27 private: |
| 33 content::NotificationRegistrar registrar_; | |
| 34 | |
| 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_ |
| OLD | NEW |