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

Side by Side Diff: chrome/browser/chromeos/system/automatic_reboot_manager.h

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_
7 7
8 #include <memory>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
15 #include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h" 16 #include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
16 #include "chromeos/dbus/power_manager_client.h" 17 #include "chromeos/dbus/power_manager_client.h"
17 #include "chromeos/dbus/update_engine_client.h" 18 #include "chromeos/dbus/update_engine_client.h"
18 #include "components/prefs/pref_change_registrar.h" 19 #include "components/prefs/pref_change_registrar.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SystemEventTimes(const base::TimeDelta& uptime, 83 SystemEventTimes(const base::TimeDelta& uptime,
83 const base::TimeDelta& update_reboot_needed_uptime); 84 const base::TimeDelta& update_reboot_needed_uptime);
84 85
85 bool has_boot_time; 86 bool has_boot_time;
86 base::TimeTicks boot_time; 87 base::TimeTicks boot_time;
87 88
88 bool has_update_reboot_needed_time; 89 bool has_update_reboot_needed_time;
89 base::TimeTicks update_reboot_needed_time; 90 base::TimeTicks update_reboot_needed_time;
90 }; 91 };
91 92
92 explicit AutomaticRebootManager(scoped_ptr<base::TickClock> clock); 93 explicit AutomaticRebootManager(std::unique_ptr<base::TickClock> clock);
93 ~AutomaticRebootManager() override; 94 ~AutomaticRebootManager() override;
94 95
95 AutomaticRebootManagerObserver::Reason reboot_reason() const { 96 AutomaticRebootManagerObserver::Reason reboot_reason() const {
96 return reboot_reason_; 97 return reboot_reason_;
97 } 98 }
98 bool reboot_requested() const { return reboot_requested_; } 99 bool reboot_requested() const { return reboot_requested_; }
99 100
100 void AddObserver(AutomaticRebootManagerObserver* observer); 101 void AddObserver(AutomaticRebootManagerObserver* observer);
101 void RemoveObserver(AutomaticRebootManagerObserver* observer); 102 void RemoveObserver(AutomaticRebootManagerObserver* observer);
102 103
(...skipping 30 matching lines...) Expand all
133 // Called whenever the status of the criteria inhibiting reboots may have 134 // Called whenever the status of the criteria inhibiting reboots may have
134 // changed. Reboots immediately if a reboot has actually been requested and 135 // changed. Reboots immediately if a reboot has actually been requested and
135 // none of the criteria inhibiting it apply anymore. Otherwise, does nothing. 136 // none of the criteria inhibiting it apply anymore. Otherwise, does nothing.
136 // If |ignore_session|, a session in progress does not inhibit reboots. 137 // If |ignore_session|, a session in progress does not inhibit reboots.
137 void MaybeReboot(bool ignore_session); 138 void MaybeReboot(bool ignore_session);
138 139
139 // Reboots immediately. 140 // Reboots immediately.
140 void Reboot(); 141 void Reboot();
141 142
142 // A clock that can be mocked in tests to fast-forward time. 143 // A clock that can be mocked in tests to fast-forward time.
143 scoped_ptr<base::TickClock> clock_; 144 std::unique_ptr<base::TickClock> clock_;
144 145
145 PrefChangeRegistrar local_state_registrar_; 146 PrefChangeRegistrar local_state_registrar_;
146 147
147 content::NotificationRegistrar notification_registrar_; 148 content::NotificationRegistrar notification_registrar_;
148 149
149 // Fires when the user has been idle on the login screen for a set amount of 150 // Fires when the user has been idle on the login screen for a set amount of
150 // time. 151 // time.
151 scoped_ptr<base::OneShotTimer> login_screen_idle_timer_; 152 std::unique_ptr<base::OneShotTimer> login_screen_idle_timer_;
152 153
153 // The time at which the device was booted, in |clock_| ticks. 154 // The time at which the device was booted, in |clock_| ticks.
154 bool have_boot_time_; 155 bool have_boot_time_;
155 base::TimeTicks boot_time_; 156 base::TimeTicks boot_time_;
156 157
157 // The time at which an update was applied and a reboot became necessary to 158 // The time at which an update was applied and a reboot became necessary to
158 // complete the update process, in |clock_| ticks. 159 // complete the update process, in |clock_| ticks.
159 bool have_update_reboot_needed_time_; 160 bool have_update_reboot_needed_time_;
160 base::TimeTicks update_reboot_needed_time_; 161 base::TimeTicks update_reboot_needed_time_;
161 162
162 // The reason for the reboot request. Updated whenever a reboot is scheduled. 163 // The reason for the reboot request. Updated whenever a reboot is scheduled.
163 AutomaticRebootManagerObserver::Reason reboot_reason_; 164 AutomaticRebootManagerObserver::Reason reboot_reason_;
164 165
165 // Whether a reboot has been requested. 166 // Whether a reboot has been requested.
166 bool reboot_requested_; 167 bool reboot_requested_;
167 168
168 // Timers that start and end the grace period. 169 // Timers that start and end the grace period.
169 scoped_ptr<base::OneShotTimer> grace_start_timer_; 170 std::unique_ptr<base::OneShotTimer> grace_start_timer_;
170 scoped_ptr<base::OneShotTimer> grace_end_timer_; 171 std::unique_ptr<base::OneShotTimer> grace_end_timer_;
171 172
172 base::ObserverList<AutomaticRebootManagerObserver, true> observers_; 173 base::ObserverList<AutomaticRebootManagerObserver, true> observers_;
173 174
174 base::WeakPtrFactory<AutomaticRebootManager> weak_ptr_factory_; 175 base::WeakPtrFactory<AutomaticRebootManager> weak_ptr_factory_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(AutomaticRebootManager); 177 DISALLOW_COPY_AND_ASSIGN(AutomaticRebootManager);
177 }; 178 };
178 179
179 } // namespace system 180 } // namespace system
180 } // namespace chromeos 181 } // namespace chromeos
181 182
182 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_ 183 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/network_menu.cc ('k') | chrome/browser/chromeos/system/automatic_reboot_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698