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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 friend class TestSiteEngagementHelper; | 83 friend class TestSiteEngagementHelper; |
83 | 84 |
84 // Ask the SiteEngagementService to record engagement via user input at the | 85 // Ask the SiteEngagementService to record engagement via user input at the |
85 // current contents location. | 86 // current contents location. |
86 virtual void RecordUserInput(); | 87 virtual void RecordUserInput(SiteEngagementMetrics::EngagementType type); |
87 | 88 |
88 // content::WebContentsObserver overrides. | 89 // content::WebContentsObserver overrides. |
89 void DidNavigateMainFrame( | 90 void DidNavigateMainFrame( |
90 const content::LoadCommittedDetails& details, | 91 const content::LoadCommittedDetails& details, |
91 const content::FrameNavigateParams& params) override; | 92 const content::FrameNavigateParams& params) override; |
92 | 93 |
93 void RenderViewHostChanged(content::RenderViewHost* old_host, | 94 void RenderViewHostChanged(content::RenderViewHost* old_host, |
94 content::RenderViewHost* new_host) override; | 95 content::RenderViewHost* new_host) override; |
95 | 96 |
96 void WasShown() override; | 97 void WasShown() override; |
97 void WasHidden() override; | 98 void WasHidden() override; |
98 | 99 |
99 InputTracker input_tracker_; | 100 InputTracker input_tracker_; |
100 bool record_engagement_; | 101 bool record_engagement_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); | 103 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); |
103 }; | 104 }; |
104 | 105 |
105 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 106 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
OLD | NEW |