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

Unified Diff: ash/wm/user_activity_detector.cc

Issue 58293003: ash: Add VLOG(1) to UserActivityDetector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/user_activity_detector.cc
diff --git a/ash/wm/user_activity_detector.cc b/ash/wm/user_activity_detector.cc
index 64cfbe311ed664d86641298009139a10c376b144..2809bb5b2a590dc68b85b81a654425fd8348500c 100644
--- a/ash/wm/user_activity_detector.cc
+++ b/ash/wm/user_activity_detector.cc
@@ -5,10 +5,37 @@
#include "ash/wm/user_activity_detector.h"
#include "ash/wm/user_activity_observer.h"
+#include "base/format_macros.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
#include "ui/events/event.h"
namespace ash {
+namespace {
+
+// Returns a string describing |event|.
+std::string GetEventDebugString(const ui::Event* event) {
+ std::string details = base::StringPrintf(
+ "type=%d name=%s flags=%d time=%" PRId64,
+ event->type(), event->name().c_str(), event->flags(),
+ event->time_stamp().InMilliseconds());
+
+ if (event->IsKeyEvent()) {
+ details += base::StringPrintf(" key_code=%d",
+ static_cast<const ui::KeyEvent*>(event)->key_code());
+ } else if (event->IsMouseEvent() || event->IsTouchEvent() ||
+ event->IsGestureEvent()) {
+ details += base::StringPrintf(" location=%s",
+ static_cast<const ui::LocatedEvent*>(
+ event)->location().ToString().c_str());
+ }
+
+ return details;
+}
+
+} // namespace
+
const int UserActivityDetector::kNotifyIntervalMs = 200;
// Too low and mouse events generated at the tail end of reconfiguration
@@ -75,6 +102,8 @@ void UserActivityDetector::HandleActivity(const ui::Event* event) {
if (last_observer_notification_time_.is_null() ||
(now - last_observer_notification_time_).InMillisecondsF() >=
kNotifyIntervalMs) {
+ if (VLOG_IS_ON(1))
+ VLOG(1) << "Reporting user activity: " << GetEventDebugString(event);
FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event));
last_observer_notification_time_ = now;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698