| 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/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "chrome/browser/engagement/site_engagement_metrics.h" |
| 11 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 14 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class WebContents; | 17 class WebContents; |
| 17 } | 18 } |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; | 90 content::RenderWidgetHost::MouseEventCallback mouse_event_callback_; |
| 90 bool callbacks_added_; | 91 bool callbacks_added_; |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 explicit SiteEngagementHelper(content::WebContents* web_contents); | 94 explicit SiteEngagementHelper(content::WebContents* web_contents); |
| 94 friend class content::WebContentsUserData<SiteEngagementHelper>; | 95 friend class content::WebContentsUserData<SiteEngagementHelper>; |
| 95 friend class SiteEngagementServiceBrowserTest; | 96 friend class SiteEngagementServiceBrowserTest; |
| 96 | 97 |
| 97 // Ask the SiteEngagementService to record engagement via user input at the | 98 // Ask the SiteEngagementService to record engagement via user input at the |
| 98 // current contents location. | 99 // current contents location. |
| 99 void RecordUserInput(); | 100 void RecordUserInput(SiteEngagementMetrics::EngagementType type); |
| 100 | 101 |
| 101 void SetTimerForTesting(scoped_ptr<base::Timer> timer); | 102 void SetTimerForTesting(scoped_ptr<base::Timer> timer); |
| 102 | 103 |
| 103 static void EnableCallbackRegistrationForTesting(); | 104 static void EnableCallbackRegistrationForTesting(); |
| 104 static void DisableCallbackRegistrationForTesting(); | 105 static void DisableCallbackRegistrationForTesting(); |
| 105 | 106 |
| 106 // content::WebContentsObserver overrides. | 107 // content::WebContentsObserver overrides. |
| 107 void DidNavigateMainFrame( | 108 void DidNavigateMainFrame( |
| 108 const content::LoadCommittedDetails& details, | 109 const content::LoadCommittedDetails& details, |
| 109 const content::FrameNavigateParams& params) override; | 110 const content::FrameNavigateParams& params) override; |
| 110 | 111 |
| 111 void RenderViewHostChanged(content::RenderViewHost* old_host, | 112 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 112 content::RenderViewHost* new_host) override; | 113 content::RenderViewHost* new_host) override; |
| 113 | 114 |
| 114 void WasShown() override; | 115 void WasShown() override; |
| 115 void WasHidden() override; | 116 void WasHidden() override; |
| 116 | 117 |
| 117 scoped_ptr<InputTracker> input_tracker_; | 118 scoped_ptr<InputTracker> input_tracker_; |
| 118 base::ObserverList<Observer> observer_list_; | 119 base::ObserverList<Observer> observer_list_; |
| 119 bool record_engagement_; | 120 bool record_engagement_; |
| 120 | 121 |
| 121 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); | 122 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ | 125 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ |
| OLD | NEW |