OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "chrome/browser/engagement/site_engagement_metrics.h" |
10 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
11 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
12 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 class GURL; | 19 class GURL; |
19 | 20 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; | 76 content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; |
76 bool callbacks_added_; | 77 bool callbacks_added_; |
77 }; | 78 }; |
78 | 79 |
79 explicit SiteEngagementHelper(content::WebContents* web_contents); | 80 explicit SiteEngagementHelper(content::WebContents* web_contents); |
80 friend class content::WebContentsUserData<SiteEngagementHelper>; | 81 friend class content::WebContentsUserData<SiteEngagementHelper>; |
81 friend class SiteEngagementServiceBrowserTest; | 82 friend class SiteEngagementServiceBrowserTest; |
82 | 83 |
83 // Ask the SiteEngagementService to record engagement via user input at the | 84 // Ask the SiteEngagementService to record engagement via user input at the |
84 // current contents location. | 85 // current contents location. |
85 void RecordUserInput(); | 86 void RecordUserInput(SiteEngagementMetrics::EngagementType type); |
86 | 87 |
87 bool ShouldRecordEngagement(); | 88 bool ShouldRecordEngagement(); |
88 | 89 |
89 // content::WebContentsObserver overrides. | 90 // content::WebContentsObserver overrides. |
90 void DidNavigateMainFrame( | 91 void DidNavigateMainFrame( |
91 const content::LoadCommittedDetails& details, | 92 const content::LoadCommittedDetails& details, |
92 const content::FrameNavigateParams& params) override; | 93 const content::FrameNavigateParams& params) override; |
93 | 94 |
94 void RenderViewHostChanged(content::RenderViewHost* old_host, | 95 void RenderViewHostChanged(content::RenderViewHost* old_host, |
95 content::RenderViewHost* new_host) override; | 96 content::RenderViewHost* new_host) override; |
96 | 97 |
97 void WasShown() override; | 98 void WasShown() override; |
98 void WasHidden() override; | 99 void WasHidden() override; |
99 | 100 |
100 InputTracker input_tracker_; | 101 InputTracker input_tracker_; |
101 bool record_engagement_; | 102 bool record_engagement_; |
102 | 103 |
103 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); | 104 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); |
104 }; | 105 }; |
105 | 106 |
106 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 107 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
OLD | NEW |