OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 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 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "content/browser/media/capture/window_activity_tracker.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "ui/aura/window.h" |
| 14 #include "ui/events/event_handler.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // Tracks UI events and makes a decision on whether the user has been |
| 19 // actively interacting with a specified window. |
| 20 class CONTENT_EXPORT WindowActivityTrackerAura : public WindowActivityTracker, |
| 21 public ui::EventHandler, |
| 22 public aura::WindowObserver { |
| 23 public: |
| 24 explicit WindowActivityTrackerAura(aura::Window* window); |
| 25 ~WindowActivityTrackerAura() final; |
| 26 |
| 27 // WindowActivityTracker overrides. |
| 28 bool IsUiInteractionActive() const final; |
| 29 void Reset() final; |
| 30 base::WeakPtr<WindowActivityTracker> GetWeakPtr() final; |
| 31 |
| 32 private: |
| 33 // ui::EventHandler overrides. |
| 34 void OnEvent(ui::Event* event) final; |
| 35 |
| 36 // aura::WindowObserver overrides. |
| 37 void OnWindowDestroying(aura::Window* window) final; |
| 38 |
| 39 aura::Window* window_; |
| 40 |
| 41 // The last time a UI event was detected. |
| 42 base::TimeTicks last_time_ui_event_detected_; |
| 43 |
| 44 // The number of UI events detected so far. In case of continuous events |
| 45 // such as mouse movement, a single continuous movement is treated |
| 46 // as one event. |
| 47 int ui_events_count_; |
| 48 |
| 49 base::WeakPtrFactory<WindowActivityTrackerAura> weak_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(WindowActivityTrackerAura); |
| 52 }; |
| 53 |
| 54 } // namespace content |
| 55 |
| 56 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_ |
OLD | NEW |