| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_OBSERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "content/public/browser/render_widget_host.h" |
| 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 14 |
| 15 class DesktopEngagementService; |
| 16 |
| 17 class DesktopEngagementObserver |
| 18 : public content::WebContentsObserver, |
| 19 public content::WebContentsUserData<DesktopEngagementObserver>, |
| 20 public content::RenderWidgetHost::InputEventObserver { |
| 21 public: |
| 22 DesktopEngagementObserver(content::WebContents* web_contents, |
| 23 DesktopEngagementService* service); |
| 24 ~DesktopEngagementObserver() override; |
| 25 |
| 26 static DesktopEngagementObserver* CreateForWebContents( |
| 27 content::WebContents* web_contents); |
| 28 |
| 29 private: |
| 30 friend class content::WebContentsUserData<DesktopEngagementObserver>; |
| 31 |
| 32 // Register / Unregister input event callback to given RenderViewHost |
| 33 void RegisterInputEventObserver(content::RenderViewHost* host); |
| 34 void UnregisterInputEventObserver(content::RenderViewHost* host); |
| 35 |
| 36 // content::RenderWidgetHost::InputEventObserver: |
| 37 void OnInputEvent(const blink::WebInputEvent& event) override; |
| 38 |
| 39 // content::WebContentsObserver: |
| 40 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 41 content::RenderViewHost* new_host) override; |
| 42 |
| 43 DesktopEngagementService* service_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(DesktopEngagementObserver); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_OBSERVER_H_ |
| OLD | NEW |