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

Unified Diff: chrome/browser/chromeos/system/automatic_reboot_manager.cc

Issue 741473002: Revert of Fire notifications when reboot is requested, not scheduled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@managed_cros
Patch Set: Created 6 years, 1 month 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/system/automatic_reboot_manager.cc
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager.cc b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
index c1b5c90c7ce481024c1b71a66565db75b5d6d009..81d6dcdfc3ff888994f99c15c930ea47013388f9 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager.cc
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
@@ -32,6 +32,7 @@
#include "base/time/tick_clock.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_paths.h"
#include "chromeos/chromeos_switches.h"
@@ -150,7 +151,6 @@
: clock_(clock.Pass()),
have_boot_time_(false),
have_update_reboot_needed_time_(false),
- reboot_reason_(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN),
reboot_requested_(false),
weak_ptr_factory_(this) {
local_state_registrar_.Init(g_browser_process->local_state());
@@ -226,7 +226,7 @@
// so that only the time of the first notification is taken into account and
// repeated notifications do not postpone the reboot request and grace period.
if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT ||
- have_update_reboot_needed_time_) {
+ !have_boot_time_ || have_update_reboot_needed_time_) {
return;
}
@@ -317,6 +317,8 @@
reboot_requested_ = false;
const base::TimeDelta kZeroTimeDelta;
+ AutomaticRebootManagerObserver::Reason reboot_reason =
+ AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN;
// If an uptime limit is set, calculate the time at which it should cause a
// reboot to be requested.
@@ -325,7 +327,7 @@
base::TimeTicks reboot_request_time = boot_time_ + uptime_limit;
bool have_reboot_request_time = uptime_limit != kZeroTimeDelta;
if (have_reboot_request_time)
- reboot_reason_ = AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC;
+ reboot_reason = AutomaticRebootManagerObserver::REBOOT_REASON_PERIODIC;
// If the policy to automatically reboot after an update is enabled and an
// update has been applied, set the time at which a reboot should be
@@ -337,7 +339,7 @@
update_reboot_needed_time_ < reboot_request_time)) {
reboot_request_time = update_reboot_needed_time_;
have_reboot_request_time = true;
- reboot_reason_ = AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE;
+ reboot_reason = AutomaticRebootManagerObserver::REBOOT_REASON_OS_UPDATE;
}
// If no reboot should be requested, remove any grace period.
@@ -373,15 +375,15 @@
base::Bind(&AutomaticRebootManager::Reboot,
base::Unretained(this)));
+ DCHECK_NE(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN,
+ reboot_reason);
+ FOR_EACH_OBSERVER(AutomaticRebootManagerObserver,
+ observers_,
+ OnRebootScheduled(reboot_reason));
}
void AutomaticRebootManager::RequestReboot() {
reboot_requested_ = true;
- DCHECK_NE(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN,
- reboot_reason_);
- FOR_EACH_OBSERVER(AutomaticRebootManagerObserver,
- observers_,
- OnRebootRequested(reboot_reason_));
MaybeReboot(false);
}

Powered by Google App Engine
This is Rietveld 408576698