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

Unified Diff: chrome/browser/chromeos/login/screens/update_screen.cc

Issue 2952083002: Remove unnecessary logic from UpdateScreen (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/screens/update_screen.cc
diff --git a/chrome/browser/chromeos/login/screens/update_screen.cc b/chrome/browser/chromeos/login/screens/update_screen.cc
index f054b10236a213049afdee0840740a4bc7e8b52d..d26f50f7aa1dc56e28e23ef7b36ccbf7ff7476f0 100644
--- a/chrome/browser/chromeos/login/screens/update_screen.cc
+++ b/chrome/browser/chromeos/login/screens/update_screen.cc
@@ -242,7 +242,6 @@ void UpdateScreen::UpdateStatusChanged(
HostPairingController::UPDATE_STATUS_UPDATING);
break;
case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE:
- ClearUpdateCheckNoUpdateTime();
MakeSureScreenIsShown();
GetContextEditor()
.SetInteger(kContextKeyProgress, kBeforeDownloadProgress)
@@ -556,18 +555,11 @@ void UpdateScreen::StartUpdateCheck() {
if (state_ == State::STATE_ERROR)
HideErrorMessage();
- if (ShouldCheckForUpdate()) {
- state_ = State::STATE_UPDATE;
- DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
- VLOG(1) << "Initiate update check";
- RecordUpdateCheckWithNoUpdateYet();
- DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
- base::Bind(StartUpdateCallback, this));
- } else {
- LOG(WARNING) << "Skipping update check since one was done recently "
- "which did not result in an update.";
- CancelUpdate();
- }
+ state_ = State::STATE_UPDATE;
+ DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
+ VLOG(1) << "Initiate update check";
+ DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
+ base::Bind(StartUpdateCallback, this));
}
void UpdateScreen::ShowErrorMessage() {
@@ -638,34 +630,4 @@ void UpdateScreen::OnConnectRequested() {
}
}
-void UpdateScreen::RecordUpdateCheckWithNoUpdateYet() {
- StartupUtils::SaveTimeOfLastUpdateCheckWithoutUpdate(base::Time::Now());
-}
-
-void UpdateScreen::ClearUpdateCheckNoUpdateTime() {
- StartupUtils::ClearTimeOfLastUpdateCheckWithoutUpdate();
-}
-
-bool UpdateScreen::ShouldCheckForUpdate() {
- // Always run update check for non hands-off enrollment.
- if (!WizardController::UsingHandsOffEnrollment())
- return true;
-
- // If we check for an update and there is no need to perform an update,
- // this is the time in hours we should wait before checking again.
- const base::TimeDelta kUpdateCheckRecencyThreshold =
- base::TimeDelta::FromHours(1);
-
- base::Time now = base::Time::Now();
- base::Time last = StartupUtils::GetTimeOfLastUpdateCheckWithoutUpdate();
-
- // Return false if enough time has not passed since the last update check.
- // Otherwise, return true.
- if (now > last) {
- return (now - last) > kUpdateCheckRecencyThreshold;
- }
-
- return true;
-}
-
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/screens/update_screen.h ('k') | chrome/browser/chromeos/login/screens/update_screen_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698