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

Unified Diff: content/browser/media/capture/ui_activity_tracker_aura.h

Issue 1484403002: cast: Support for low-latency interactive mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: content/browser/media/capture/ui_activity_tracker_aura.h
diff --git a/content/browser/media/capture/ui_activity_tracker_aura.h b/content/browser/media/capture/ui_activity_tracker_aura.h
new file mode 100644
index 0000000000000000000000000000000000000000..cfa7f33d1cc7d2a594168b8923d9a9bff4d2e98f
--- /dev/null
+++ b/content/browser/media/capture/ui_activity_tracker_aura.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2015 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 CONTENT_BROWSER_MEDIA_CAPTURE_UI_ACTIVITY_TRACKER_AURA_H_
+#define CONTENT_BROWSER_MEDIA_CAPTURE_UI_ACTIVITY_TRACKER_AURA_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "content/browser/media/capture/ui_activity_tracker.h"
+#include "content/common/content_export.h"
+#include "ui/aura/window.h"
+#include "ui/events/event_handler.h"
+
+namespace content {
+
+// Tracks UI events and makes a decision on whether the user has been
+// actively interacting with a specified window.
+class CONTENT_EXPORT UiActivityTrackerAura : public UiActivityTracker,
+ public ui::EventHandler,
+ public aura::WindowObserver {
+ public:
+ explicit UiActivityTrackerAura(aura::Window* window);
+ ~UiActivityTrackerAura() final;
+
+ // UiActivityTracker overrides.
+ bool uiInteractionActive() const final;
+ void reset() final;
+ base::WeakPtr<UiActivityTracker> GetWeakPtr() final;
+
+ // ui::EventHandler overrides.
+ void OnEvent(ui::Event* event) final;
miu 2015/12/03 21:26:22 nit: This method and OnWindowDestroying() should p
Irfan 2015/12/04 22:45:37 Done.
+
+ // aura::WindowObserver overrides.
+ void OnWindowDestroying(aura::Window* window) final;
+
+ private:
+ aura::Window* window_;
+
+ // The last time a UI event was detected.
+ base::TimeTicks last_time_ui_event_detected_;
+ // The number of UI events detected so far. In case of continuous events
+ // such as mouse movement, a single continuous movement is treated
+ // as one event.
+ int ui_events_count_;
+
+ base::WeakPtrFactory<UiActivityTrackerAura> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(UiActivityTrackerAura);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_CAPTURE_UI_ACTIVITY_TRACKER_AURA_H_

Powered by Google App Engine
This is Rietveld 408576698