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

Unified Diff: ash/mus/user_activity_forwarder.h

Issue 2639703004: mus: Forward user activity from window server to detector. (Closed)
Patch Set: add comments to UserActivityPowerManagerNotifier 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: ash/mus/user_activity_forwarder.h
diff --git a/ash/mus/user_activity_forwarder.h b/ash/mus/user_activity_forwarder.h
new file mode 100644
index 0000000000000000000000000000000000000000..521e8f6a57dfd11ee1342dc12abcee04697a4f62
--- /dev/null
+++ b/ash/mus/user_activity_forwarder.h
@@ -0,0 +1,50 @@
+// 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 ASH_MUS_USER_ACTIVITY_FORWARDER_H_
+#define ASH_MUS_USER_ACTIVITY_FORWARDER_H_
sadrul 2017/01/18 22:10:58 Would it make sense for this to live in the client
Daniel Erat 2017/01/19 01:56:24 sure! i didn't know about that directory, but it l
+
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "services/ui/public/interfaces/user_activity_monitor.mojom.h"
+
+namespace service_manager {
+class Connector;
+}
+
+namespace ui {
+class UserActivityDetector;
+}
+
+namespace ash {
+namespace mus {
+
+// Helper class that receives reports of user activity from UserActivityMonitor
+// 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 UserActivityForwarder : public ui::mojom::UserActivityObserver {
+ public:
+ UserActivityForwarder(service_manager::Connector* connector,
sadrul 2017/01/18 22:10:58 Instead of sending the connector here, can you sen
Daniel Erat 2017/01/19 01:56:24 sounds fine to me. do we have an existing pattern
sadrul 2017/01/19 04:27:45 I have used stub implementations before (e.g. [1])
+ ui::UserActivityDetector* detector);
+ ~UserActivityForwarder() override;
+
+ private:
+ // ui::mojom::UserActivityObserver:
+ void OnUserActivity() override;
+
+ ui::mojom::UserActivityMonitorPtr user_activity_monitor_;
+ mojo::Binding<ui::mojom::UserActivityObserver>
+ user_activity_observer_binding_;
+
+ ui::UserActivityDetector* user_activity_detector_; // Not owned.
+
+ DISALLOW_COPY_AND_ASSIGN(UserActivityForwarder);
+};
+
+} // namespace mus
+} // namespace ash
+
+#endif // ASH_MUS_USER_ACTIVITY_FORWARDER_H_

Powered by Google App Engine
This is Rietveld 408576698