| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/upgrade_detector_impl.h" | 5 #include "chrome/browser/upgrade_detector_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/build_time.h" | 10 #include "base/build_time.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), | 352 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), |
| 353 this, &UpgradeDetectorImpl::CheckForUpgrade); | 353 this, &UpgradeDetectorImpl::CheckForUpgrade); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void UpgradeDetectorImpl::StartUpgradeNotificationTimer() { | 356 void UpgradeDetectorImpl::StartUpgradeNotificationTimer() { |
| 357 // The timer may already be running (e.g. due to both a software upgrade and | 357 // The timer may already be running (e.g. due to both a software upgrade and |
| 358 // experiment updates being available). | 358 // experiment updates being available). |
| 359 if (upgrade_notification_timer_.IsRunning()) | 359 if (upgrade_notification_timer_.IsRunning()) |
| 360 return; | 360 return; |
| 361 | 361 |
| 362 upgrade_detected_time_ = base::Time::Now(); | 362 upgrade_detected_time_ = base::TimeTicks::Now(); |
| 363 | 363 |
| 364 // Start the repeating timer for notifying the user after a certain period. | 364 // Start the repeating timer for notifying the user after a certain period. |
| 365 // The called function will eventually figure out that enough time has passed | 365 // The called function will eventually figure out that enough time has passed |
| 366 // and stop the timer. | 366 // and stop the timer. |
| 367 const int cycle_time_ms = IsTesting() ? | 367 const int cycle_time_ms = IsTesting() ? |
| 368 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs; | 368 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs; |
| 369 upgrade_notification_timer_.Start(FROM_HERE, | 369 upgrade_notification_timer_.Start(FROM_HERE, |
| 370 base::TimeDelta::FromMilliseconds(cycle_time_ms), | 370 base::TimeDelta::FromMilliseconds(cycle_time_ms), |
| 371 this, &UpgradeDetectorImpl::NotifyOnUpgrade); | 371 this, &UpgradeDetectorImpl::NotifyOnUpgrade); |
| 372 } | 372 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } else { | 505 } else { |
| 506 return; // Not ready to recommend upgrade. | 506 return; // Not ready to recommend upgrade. |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 NotifyUpgradeRecommended(); | 510 NotifyUpgradeRecommended(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void UpgradeDetectorImpl::NotifyOnUpgrade() { | 513 void UpgradeDetectorImpl::NotifyOnUpgrade() { |
| 514 const base::TimeDelta time_passed = | 514 const base::TimeDelta time_passed = |
| 515 base::Time::Now() - upgrade_detected_time_; | 515 base::TimeTicks::Now() - upgrade_detected_time_; |
| 516 NotifyOnUpgradeWithTimePassed(time_passed); | 516 NotifyOnUpgradeWithTimePassed(time_passed); |
| 517 } | 517 } |
| 518 | 518 |
| 519 // static | 519 // static |
| 520 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { | 520 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { |
| 521 return Singleton<UpgradeDetectorImpl>::get(); | 521 return Singleton<UpgradeDetectorImpl>::get(); |
| 522 } | 522 } |
| 523 | 523 |
| 524 // static | 524 // static |
| 525 UpgradeDetector* UpgradeDetector::GetInstance() { | 525 UpgradeDetector* UpgradeDetector::GetInstance() { |
| 526 return UpgradeDetectorImpl::GetInstance(); | 526 return UpgradeDetectorImpl::GetInstance(); |
| 527 } | 527 } |
| OLD | NEW |