| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 int fd = HANDLE_EINTR(open(update_reboot_needed_uptime_file.value().c_str(), | 111 int fd = HANDLE_EINTR(open(update_reboot_needed_uptime_file.value().c_str(), |
| 112 O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW, | 112 O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW, |
| 113 0666)); | 113 0666)); |
| 114 if (fd < 0) | 114 if (fd < 0) |
| 115 return; | 115 return; |
| 116 file_util::ScopedFD fd_closer(&fd); | 116 file_util::ScopedFD fd_closer(&fd); |
| 117 | 117 |
| 118 std::string update_reboot_needed_uptime = | 118 std::string update_reboot_needed_uptime = |
| 119 base::DoubleToString(uptime.InSecondsF()); | 119 base::DoubleToString(uptime.InSecondsF()); |
| 120 file_util::WriteFileDescriptor(fd, | 120 base::WriteFileDescriptor(fd, update_reboot_needed_uptime.c_str(), |
| 121 update_reboot_needed_uptime.c_str(), | 121 update_reboot_needed_uptime.size()); |
| 122 update_reboot_needed_uptime.size()); | |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace | 124 } // namespace |
| 126 | 125 |
| 127 AutomaticRebootManager::SystemEventTimes::SystemEventTimes() | 126 AutomaticRebootManager::SystemEventTimes::SystemEventTimes() |
| 128 : has_boot_time(false), | 127 : has_boot_time(false), |
| 129 has_update_reboot_needed_time(false) { | 128 has_update_reboot_needed_time(false) { |
| 130 } | 129 } |
| 131 | 130 |
| 132 AutomaticRebootManager::SystemEventTimes::SystemEventTimes( | 131 AutomaticRebootManager::SystemEventTimes::SystemEventTimes( |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 409 } |
| 411 | 410 |
| 412 login_screen_idle_timer_.reset(); | 411 login_screen_idle_timer_.reset(); |
| 413 grace_start_timer_.reset(); | 412 grace_start_timer_.reset(); |
| 414 grace_end_timer_.reset(); | 413 grace_end_timer_.reset(); |
| 415 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 414 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 416 } | 415 } |
| 417 | 416 |
| 418 } // namespace system | 417 } // namespace system |
| 419 } // namespace chromeos | 418 } // namespace chromeos |
| OLD | NEW |