OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #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" |
| 14 |
| 15 UserActionsUIHandler::UserActionsUIHandler() : NotificationObserver() { |
| 16 registrar_.Add(this, |
| 17 content::NOTIFICATION_USER_ACTION, |
| 18 content::NotificationService::AllSources()); |
| 19 } |
| 20 |
| 21 UserActionsUIHandler::~UserActionsUIHandler() { |
| 22 } |
| 23 |
| 24 void UserActionsUIHandler::Observe( |
| 25 int type, |
| 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", |
| 32 user_action_name); |
| 33 } |
| 34 |
| 35 void UserActionsUIHandler::RegisterMessages() {} |
OLD | NEW |