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_UI_ACTIVITY_TRACKER_AURA_H_ | |
6 #define CONTENT_BROWSER_MEDIA_CAPTURE_UI_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/ui_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 UiActivityTrackerAura : public UiActivityTracker, | |
21 public ui::EventHandler, | |
22 public aura::WindowObserver { | |
23 public: | |
24 explicit UiActivityTrackerAura(aura::Window* window); | |
25 ~UiActivityTrackerAura() final; | |
26 | |
27 // UiActivityTracker overrides. | |
28 bool uiInteractionActive() const final; | |
29 void reset() final; | |
30 base::WeakPtr<UiActivityTracker> GetWeakPtr() final; | |
31 | |
32 // ui::EventHandler overrides. | |
33 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.
| |
34 | |
35 // aura::WindowObserver overrides. | |
36 void OnWindowDestroying(aura::Window* window) final; | |
37 | |
38 private: | |
39 aura::Window* window_; | |
40 | |
41 // The last time a UI event was detected. | |
42 base::TimeTicks last_time_ui_event_detected_; | |
43 // The number of UI events detected so far. In case of continuous events | |
44 // such as mouse movement, a single continuous movement is treated | |
45 // as one event. | |
46 int ui_events_count_; | |
47 | |
48 base::WeakPtrFactory<UiActivityTrackerAura> weak_factory_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(UiActivityTrackerAura); | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_UI_ACTIVITY_TRACKER_AURA_H_ | |
OLD | NEW |