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 <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 has_boot_time = true; | 141 has_boot_time = true; |
142 if (update_reboot_needed_uptime == kZeroTimeDelta) | 142 if (update_reboot_needed_uptime == kZeroTimeDelta) |
143 return; | 143 return; |
144 // Calculate the time at which an update was applied and a reboot became | 144 // Calculate the time at which an update was applied and a reboot became |
145 // necessary in base::TimeTicks::Now() ticks. | 145 // necessary in base::TimeTicks::Now() ticks. |
146 update_reboot_needed_time = boot_time + update_reboot_needed_uptime; | 146 update_reboot_needed_time = boot_time + update_reboot_needed_uptime; |
147 has_update_reboot_needed_time = true; | 147 has_update_reboot_needed_time = true; |
148 } | 148 } |
149 | 149 |
150 AutomaticRebootManager::AutomaticRebootManager( | 150 AutomaticRebootManager::AutomaticRebootManager( |
151 scoped_ptr<base::TickClock> clock) | 151 const scoped_refptr<base::TickClock>& clock) |
152 : clock_(clock.Pass()), | 152 : clock_(clock), |
153 have_boot_time_(false), | 153 have_boot_time_(false), |
154 have_update_reboot_needed_time_(false), | 154 have_update_reboot_needed_time_(false), |
155 reboot_requested_(false), | 155 reboot_requested_(false), |
156 weak_ptr_factory_(this) { | 156 weak_ptr_factory_(this) { |
157 local_state_registrar_.Init(g_browser_process->local_state()); | 157 local_state_registrar_.Init(g_browser_process->local_state()); |
158 local_state_registrar_.Add(prefs::kUptimeLimit, | 158 local_state_registrar_.Add(prefs::kUptimeLimit, |
159 base::Bind(&AutomaticRebootManager::Reschedule, | 159 base::Bind(&AutomaticRebootManager::Reschedule, |
160 base::Unretained(this))); | 160 base::Unretained(this))); |
161 local_state_registrar_.Add(prefs::kRebootAfterUpdate, | 161 local_state_registrar_.Add(prefs::kRebootAfterUpdate, |
162 base::Bind(&AutomaticRebootManager::Reschedule, | 162 base::Bind(&AutomaticRebootManager::Reschedule, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 410 } |
411 | 411 |
412 login_screen_idle_timer_.reset(); | 412 login_screen_idle_timer_.reset(); |
413 grace_start_timer_.reset(); | 413 grace_start_timer_.reset(); |
414 grace_end_timer_.reset(); | 414 grace_end_timer_.reset(); |
415 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 415 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
416 } | 416 } |
417 | 417 |
418 } // namespace system | 418 } // namespace system |
419 } // namespace chromeos | 419 } // namespace chromeos |
OLD | NEW |