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

Unified Diff: ui/aura/mus/user_activity_forwarder.h

Issue 2639703004: mus: Forward user activity from window server to detector. (Closed)
Patch Set: fix mash_unittests and use NON_EXPORTED_BASE() Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/mus/user_activity_forwarder.h
diff --git a/ui/aura/mus/user_activity_forwarder.h b/ui/aura/mus/user_activity_forwarder.h
new file mode 100644
index 0000000000000000000000000000000000000000..e201e7554e4829477b24f7b9628a858b15430aa3
--- /dev/null
+++ b/ui/aura/mus/user_activity_forwarder.h
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_MUS_USER_ACTIVITY_FORWARDER_H_
+#define UI_AURA_MUS_USER_ACTIVITY_FORWARDER_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "services/ui/public/interfaces/user_activity_monitor.mojom.h"
+#include "ui/aura/aura_export.h"
+
+namespace ui {
+class UserActivityDetector;
+}
+
+namespace aura {
+
+// Helper class that receives reports of user activity from UserActivityMonitor
James Cook 2017/01/20 03:38:49 super nit: I find it helpful for classes like this
Daniel Erat 2017/01/20 16:49:45 sure, done! i like these comments too.
+// and forwards them to ui::UserActivityDetector.
+// TODO(derat): Make current ui::UserActivityObserver implementations (i.e.
+// downstream of ui::UserActivityDetector) instead observe UserActivityMonitor
+// directly: http://crbug.com/626899
+class AURA_EXPORT UserActivityForwarder
+ : NON_EXPORTED_BASE(public ui::mojom::UserActivityObserver) {
+ public:
+ UserActivityForwarder(ui::mojom::UserActivityMonitorPtr monitor,
+ ui::UserActivityDetector* detector);
+ ~UserActivityForwarder() override;
+
+ private:
+ // ui::mojom::UserActivityObserver:
+ void OnUserActivity() override;
+
+ ui::mojom::UserActivityMonitorPtr monitor_;
+ mojo::Binding<ui::mojom::UserActivityObserver> binding_;
+
+ ui::UserActivityDetector* detector_; // Not owned.
+
+ DISALLOW_COPY_AND_ASSIGN(UserActivityForwarder);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_MUS_USER_ACTIVITY_FORWARDER_H_

Powered by Google App Engine
This is Rietveld 408576698