Chromium Code Reviews| Index: chrome/browser/engagement/site_engagement_helper.h |
| diff --git a/chrome/browser/engagement/site_engagement_helper.h b/chrome/browser/engagement/site_engagement_helper.h |
| index af059d431b24d98915c81add6e339156697d6519..1be83ad0360a0caeecd4d1d75084da60206e0c8b 100644 |
| --- a/chrome/browser/engagement/site_engagement_helper.h |
| +++ b/chrome/browser/engagement/site_engagement_helper.h |
| @@ -25,7 +25,9 @@ class SiteEngagementHelper |
| public: |
| ~SiteEngagementHelper() override; |
| - static void SetSecondsBetweenUserInputCheck(double seconds); |
| + static void SetSecondsBetweenUserInputCheck(int seconds); |
| + static void SetSecondsTrackingDelayAfterNavigation(int seconds); |
| + static void SetSecondsTrackingDelayAfterShow(int seconds); |
| private: |
| // Class to encapsulate the user input listening. |
| @@ -51,28 +53,38 @@ class SiteEngagementHelper |
| bool HandleMouseEvent(const blink::WebMouseEvent& event); |
| // Register callbacks to listen for user input. |
| - void StartTracking(content::RenderViewHost* host); |
| + void StartTracking(content::RenderViewHost* host, int initial_delay); |
| - // Pause listening for user input, restarting listening after |
| - // g_seconds_between_user_input_check seconds. |
| - void PauseTracking(content::RenderViewHost* host); |
| - |
| - // Restart listening for user input. |
| - void ResumeTracking(); |
| + // Pause listening for user input, restarting listening after a delay. |
| + void PauseTracking(); |
| // Stop listening for user input. |
| - void StopTracking(content::RenderViewHost* host); |
| + void StopTracking(); |
| - // Set the timer object for testing purposes. |
| - void SetTimerForTesting(scoped_ptr<base::Timer> timer); |
| + // Returns whether the InputTracker has been started for a RenderViewHost. |
| + bool is_tracking() { return is_tracking_; } |
| + // Returns whether input tracking callbacks have been added to |
| + // RenderViewHost. |
| bool callbacks_added() { return callbacks_added_; } |
| + // Set the timer object for testing purposes. |
| + void SetPauseTimerForTesting(scoped_ptr<base::Timer> timer); |
| + |
| private: |
| + // Starts the timer for adding callbacks to the RenderViewHost. |
| + void StartTimer(int delay); |
| + |
| + // Adds/removes tracking callbacks to the RenderViewHost. |
| + void AddCallbacks(); |
| + void RemoveCallbacks(); |
| + |
| SiteEngagementHelper* helper_; |
| scoped_ptr<base::Timer> pause_timer_; |
| + content::RenderViewHost* host_; |
| content::RenderWidgetHost::KeyPressEventCallback key_press_event_callback_; |
| content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; |
| + bool is_tracking_; |
| bool callbacks_added_; |
|
dominickn
2015/10/06 04:11:46
I don't think both of these bools are necessary. C
|
| }; |
| @@ -84,16 +96,12 @@ class SiteEngagementHelper |
| // current contents location. |
| void RecordUserInput(); |
| - bool ShouldRecordEngagement(); |
| - |
| // content::WebContentsObserver overrides. |
| void DidNavigateMainFrame( |
| const content::LoadCommittedDetails& details, |
| const content::FrameNavigateParams& params) override; |
| - |
| void RenderViewHostChanged(content::RenderViewHost* old_host, |
| content::RenderViewHost* new_host) override; |
| - |
| void WasShown() override; |
| void WasHidden() override; |