| 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 virtual bool ShouldRecordEngagement(); | 89 virtual bool ShouldRecordEngagement(); |
| 89 | 90 |
| 90 // content::WebContentsObserver overrides. | 91 // content::WebContentsObserver overrides. |
| 91 void DidNavigateMainFrame( | 92 void DidNavigateMainFrame( |
| 92 const content::LoadCommittedDetails& details, | 93 const content::LoadCommittedDetails& details, |
| 93 const content::FrameNavigateParams& params) override; | 94 const content::FrameNavigateParams& params) override; |
| 94 | 95 |
| 95 void RenderViewHostChanged(content::RenderViewHost* old_host, | 96 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 96 content::RenderViewHost* new_host) override; | 97 content::RenderViewHost* new_host) override; |
| 97 | 98 |
| 98 void WasShown() override; | 99 void WasShown() override; |
| 99 void WasHidden() override; | 100 void WasHidden() override; |
| 100 | 101 |
| 101 InputTracker input_tracker_; | 102 InputTracker input_tracker_; |
| 102 bool record_engagement_; | 103 bool record_engagement_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); | 105 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 108 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
| OLD | NEW |