OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/system/automatic_reboot_manager.h" | 5 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 has_boot_time = true; | 143 has_boot_time = true; |
144 if (update_reboot_needed_uptime == kZeroTimeDelta) | 144 if (update_reboot_needed_uptime == kZeroTimeDelta) |
145 return; | 145 return; |
146 // Calculate the time at which an update was applied and a reboot became | 146 // Calculate the time at which an update was applied and a reboot became |
147 // necessary in base::TimeTicks::Now() ticks. | 147 // necessary in base::TimeTicks::Now() ticks. |
148 update_reboot_needed_time = boot_time + update_reboot_needed_uptime; | 148 update_reboot_needed_time = boot_time + update_reboot_needed_uptime; |
149 has_update_reboot_needed_time = true; | 149 has_update_reboot_needed_time = true; |
150 } | 150 } |
151 | 151 |
152 AutomaticRebootManager::AutomaticRebootManager( | 152 AutomaticRebootManager::AutomaticRebootManager( |
153 scoped_ptr<base::TickClock> clock) | 153 std::unique_ptr<base::TickClock> clock) |
154 : clock_(std::move(clock)), | 154 : clock_(std::move(clock)), |
155 have_boot_time_(false), | 155 have_boot_time_(false), |
156 have_update_reboot_needed_time_(false), | 156 have_update_reboot_needed_time_(false), |
157 reboot_reason_(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN), | 157 reboot_reason_(AutomaticRebootManagerObserver::REBOOT_REASON_UNKNOWN), |
158 reboot_requested_(false), | 158 reboot_requested_(false), |
159 weak_ptr_factory_(this) { | 159 weak_ptr_factory_(this) { |
160 local_state_registrar_.Init(g_browser_process->local_state()); | 160 local_state_registrar_.Init(g_browser_process->local_state()); |
161 local_state_registrar_.Add(prefs::kUptimeLimit, | 161 local_state_registrar_.Add(prefs::kUptimeLimit, |
162 base::Bind(&AutomaticRebootManager::Reschedule, | 162 base::Bind(&AutomaticRebootManager::Reschedule, |
163 base::Unretained(this))); | 163 base::Unretained(this))); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 login_screen_idle_timer_.reset(); | 414 login_screen_idle_timer_.reset(); |
415 grace_start_timer_.reset(); | 415 grace_start_timer_.reset(); |
416 grace_end_timer_.reset(); | 416 grace_end_timer_.reset(); |
417 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 417 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
418 } | 418 } |
419 | 419 |
420 } // namespace system | 420 } // namespace system |
421 } // namespace chromeos | 421 } // namespace chromeos |
OLD | NEW |