| 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> |
| 8 |
| 7 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 8 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 9 #include "chrome/browser/engagement/site_engagement_service.h" | 11 #include "chrome/browser/engagement/site_engagement_service.h" |
| 10 #include "chrome/browser/engagement/site_engagement_service_factory.h" | 12 #include "chrome/browser/engagement/site_engagement_service_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
| 13 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 44 TrackingStopped(); | 46 TrackingStopped(); |
| 45 pause_timer_->Stop(); | 47 pause_timer_->Stop(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 bool SiteEngagementHelper::PeriodicTracker::IsTimerRunning() { | 50 bool SiteEngagementHelper::PeriodicTracker::IsTimerRunning() { |
| 49 return pause_timer_->IsRunning(); | 51 return pause_timer_->IsRunning(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void SiteEngagementHelper::PeriodicTracker::SetPauseTimerForTesting( | 54 void SiteEngagementHelper::PeriodicTracker::SetPauseTimerForTesting( |
| 53 scoped_ptr<base::Timer> timer) { | 55 scoped_ptr<base::Timer> timer) { |
| 54 pause_timer_ = timer.Pass(); | 56 pause_timer_ = std::move(timer); |
| 55 } | 57 } |
| 56 | 58 |
| 57 void SiteEngagementHelper::PeriodicTracker::StartTimer( | 59 void SiteEngagementHelper::PeriodicTracker::StartTimer( |
| 58 base::TimeDelta delay) { | 60 base::TimeDelta delay) { |
| 59 pause_timer_->Start( | 61 pause_timer_->Start( |
| 60 FROM_HERE, delay, | 62 FROM_HERE, delay, |
| 61 base::Bind(&SiteEngagementHelper::PeriodicTracker::TrackingStarted, | 63 base::Bind(&SiteEngagementHelper::PeriodicTracker::TrackingStarted, |
| 62 base::Unretained(this))); | 64 base::Unretained(this))); |
| 63 } | 65 } |
| 64 | 66 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 236 |
| 235 // static | 237 // static |
| 236 void SiteEngagementHelper::SetSecondsTrackingDelayAfterNavigation(int seconds) { | 238 void SiteEngagementHelper::SetSecondsTrackingDelayAfterNavigation(int seconds) { |
| 237 g_seconds_delay_after_navigation = seconds; | 239 g_seconds_delay_after_navigation = seconds; |
| 238 } | 240 } |
| 239 | 241 |
| 240 // static | 242 // static |
| 241 void SiteEngagementHelper::SetSecondsTrackingDelayAfterShow(int seconds) { | 243 void SiteEngagementHelper::SetSecondsTrackingDelayAfterShow(int seconds) { |
| 242 g_seconds_delay_after_show = seconds; | 244 g_seconds_delay_after_show = seconds; |
| 243 } | 245 } |
| OLD | NEW |