Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/browser/engagement/site_engagement_helper.h

Issue 1967013002: Migrate the site engagement service to use DidFinishNavigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/engagement/site_engagement_metrics.h"
11 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/browser/web_contents_user_data.h" 12 #include "content/public/browser/web_contents_user_data.h"
13 13
14 namespace content { 14 namespace content {
15 class NavigationHandle;
15 class WebContents; 16 class WebContents;
16 } 17 }
17 18
18 class GURL; 19 class GURL;
19 20
20 // Per-WebContents class to handle updating the site engagement scores for 21 // Per-WebContents class to handle updating the site engagement scores for
21 // origins. 22 // origins.
22 class SiteEngagementHelper 23 class SiteEngagementHelper
23 : public content::WebContentsObserver, 24 : public content::WebContentsObserver,
24 public content::WebContentsUserData<SiteEngagementHelper> { 25 public content::WebContentsUserData<SiteEngagementHelper> {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 147
147 // Ask the SiteEngagementService to record engagement via user input at the 148 // Ask the SiteEngagementService to record engagement via user input at the
148 // current WebContents URL. 149 // current WebContents URL.
149 void RecordUserInput(SiteEngagementMetrics::EngagementType type); 150 void RecordUserInput(SiteEngagementMetrics::EngagementType type);
150 151
151 // Ask the SiteEngagementService to record engagement via media playing at the 152 // Ask the SiteEngagementService to record engagement via media playing at the
152 // current WebContents URL. 153 // current WebContents URL.
153 void RecordMediaPlaying(bool is_hidden); 154 void RecordMediaPlaying(bool is_hidden);
154 155
155 // content::WebContentsObserver overrides. 156 // content::WebContentsObserver overrides.
156 void DidNavigateMainFrame( 157 void DidFinishNavigation(content::NavigationHandle* handle) override;
157 const content::LoadCommittedDetails& details,
158 const content::FrameNavigateParams& params) override;
159 void WasShown() override; 158 void WasShown() override;
160 void WasHidden() override; 159 void WasHidden() override;
161 160
162 InputTracker input_tracker_; 161 InputTracker input_tracker_;
163 MediaTracker media_tracker_; 162 MediaTracker media_tracker_;
164 bool record_engagement_; 163 bool record_engagement_;
165 164
166 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper); 165 DISALLOW_COPY_AND_ASSIGN(SiteEngagementHelper);
167 }; 166 };
168 167
169 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_ 168 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698