| 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 #include "chrome/browser/engagement/site_engagement_helper.h" | 5 #include "chrome/browser/engagement/site_engagement_helper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 content::RenderFrameHost* render_frame_host) { | 228 content::RenderFrameHost* render_frame_host) { |
| 229 blink::mojom::EngagementClientAssociatedPtr client; | 229 blink::mojom::EngagementClientAssociatedPtr client; |
| 230 render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(&client); | 230 render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(&client); |
| 231 client->SetEngagementLevel(origin, level); | 231 client->SetEngagementLevel(origin, level); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void SiteEngagementService::Helper::DidFinishNavigation( | 234 void SiteEngagementService::Helper::DidFinishNavigation( |
| 235 content::NavigationHandle* handle) { | 235 content::NavigationHandle* handle) { |
| 236 // Ignore uncommitted, non main-frame, same page, or error page navigations. | 236 // Ignore uncommitted, non main-frame, same page, or error page navigations. |
| 237 if (!handle->HasCommitted() || !handle->IsInMainFrame() || | 237 if (!handle->HasCommitted() || !handle->IsInMainFrame() || |
| 238 handle->IsSamePage() || handle->IsErrorPage()) { | 238 handle->IsSameDocument() || handle->IsErrorPage()) { |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 input_tracker_.Stop(); | 242 input_tracker_.Stop(); |
| 243 media_tracker_.Stop(); | 243 media_tracker_.Stop(); |
| 244 | 244 |
| 245 // Ignore prerender loads. This means that prerenders will not receive | 245 // Ignore prerender loads. This means that prerenders will not receive |
| 246 // navigation engagement. The implications are as follows: | 246 // navigation engagement. The implications are as follows: |
| 247 // | 247 // |
| 248 // - Instant search prerenders from the omnibox trigger DidFinishNavigation | 248 // - Instant search prerenders from the omnibox trigger DidFinishNavigation |
| (...skipping 28 matching lines...) Expand all Loading... |
| 277 void SiteEngagementService::Helper::WasShown() { | 277 void SiteEngagementService::Helper::WasShown() { |
| 278 // Ensure that the input callbacks are registered when we come into view. | 278 // Ensure that the input callbacks are registered when we come into view. |
| 279 input_tracker_.Start( | 279 input_tracker_.Start( |
| 280 base::TimeDelta::FromSeconds(g_seconds_delay_after_show)); | 280 base::TimeDelta::FromSeconds(g_seconds_delay_after_show)); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void SiteEngagementService::Helper::WasHidden() { | 283 void SiteEngagementService::Helper::WasHidden() { |
| 284 // Ensure that the input callbacks are not registered when hidden. | 284 // Ensure that the input callbacks are not registered when hidden. |
| 285 input_tracker_.Stop(); | 285 input_tracker_.Stop(); |
| 286 } | 286 } |
| OLD | NEW |