OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_DESKTOP_ENGAGEMENT_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_SESSION_DESKTOP_SESSION_OBSERVER_H_ |
6 #define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_DESKTOP_ENGAGEMENT_OBSERVER_H_ | 6 #define CHROME_BROWSER_METRICS_DESKTOP_SESSION_DESKTOP_SESSION_OBSERVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/public/browser/render_widget_host.h" | 9 #include "content/public/browser/render_widget_host.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 | 14 |
15 namespace metrics { | 15 namespace metrics { |
16 | 16 |
17 class DesktopEngagementService; | 17 class DesktopSessionService; |
18 | 18 |
19 // Tracks user input events from web contents and notifies | 19 // Tracks user input events from web contents and notifies |
20 // |DesktopEngagementService|. | 20 // |DesktopSessionService|. |
21 class DesktopEngagementObserver | 21 class DesktopSessionObserver |
22 : public content::WebContentsObserver, | 22 : public content::WebContentsObserver, |
23 public content::WebContentsUserData<DesktopEngagementObserver>, | 23 public content::WebContentsUserData<DesktopSessionObserver>, |
24 public content::RenderWidgetHost::InputEventObserver { | 24 public content::RenderWidgetHost::InputEventObserver { |
25 public: | 25 public: |
26 DesktopEngagementObserver(content::WebContents* web_contents, | 26 DesktopSessionObserver(content::WebContents* web_contents, |
27 DesktopEngagementService* service); | 27 DesktopSessionService* service); |
28 ~DesktopEngagementObserver() override; | 28 ~DesktopSessionObserver() override; |
29 | 29 |
30 static DesktopEngagementObserver* CreateForWebContents( | 30 static DesktopSessionObserver* CreateForWebContents( |
31 content::WebContents* web_contents); | 31 content::WebContents* web_contents); |
32 | 32 |
33 private: | 33 private: |
34 friend class content::WebContentsUserData<DesktopEngagementObserver>; | 34 friend class content::WebContentsUserData<DesktopSessionObserver>; |
35 | 35 |
36 // Register / Unregister input event callback to given RenderViewHost | 36 // Register / Unregister input event callback to given RenderViewHost |
37 void RegisterInputEventObserver(content::RenderViewHost* host); | 37 void RegisterInputEventObserver(content::RenderViewHost* host); |
38 void UnregisterInputEventObserver(content::RenderViewHost* host); | 38 void UnregisterInputEventObserver(content::RenderViewHost* host); |
39 | 39 |
40 // content::RenderWidgetHost::InputEventObserver: | 40 // content::RenderWidgetHost::InputEventObserver: |
41 void OnInputEvent(const blink::WebInputEvent& event) override; | 41 void OnInputEvent(const blink::WebInputEvent& event) override; |
42 | 42 |
43 // content::WebContentsObserver: | 43 // content::WebContentsObserver: |
44 void RenderViewHostChanged(content::RenderViewHost* old_host, | 44 void RenderViewHostChanged(content::RenderViewHost* old_host, |
45 content::RenderViewHost* new_host) override; | 45 content::RenderViewHost* new_host) override; |
46 | 46 |
47 DesktopEngagementService* service_; | 47 DesktopSessionService* service_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(DesktopEngagementObserver); | 49 DISALLOW_COPY_AND_ASSIGN(DesktopSessionObserver); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace metrics | 52 } // namespace metrics |
53 | 53 |
54 #endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_DESKTOP_ENGAGEMENT_OBSERVER
_H_ | 54 #endif // CHROME_BROWSER_METRICS_DESKTOP_SESSION_DESKTOP_SESSION_OBSERVER_H_ |
OLD | NEW |