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

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

Issue 16844020: app_mode: Add runtime.onRestartRequired event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
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 "ash/wm/user_activity_observer.h" 8 #include "ash/wm/user_activity_observer.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h"
13 #include "base/prefs/pref_change_registrar.h" 14 #include "base/prefs/pref_change_registrar.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "base/timer.h" 16 #include "base/timer.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 "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 21
21 class PrefRegistrySimple; 22 class PrefRegistrySimple;
22 23
23 namespace base { 24 namespace base {
24 class TickClock; 25 class TickClock;
25 } 26 }
26 27
27 namespace chromeos { 28 namespace chromeos {
28 namespace system { 29 namespace system {
29 30
31 class AutomaticRebootManagerObserver;
32
30 // Schedules and executes automatic reboots. 33 // Schedules and executes automatic reboots.
31 // 34 //
32 // Automatic reboots may be scheduled for any number of reasons. Currently, the 35 // Automatic reboots may be scheduled for any number of reasons. Currently, the
33 // following are implemented: 36 // following are implemented:
34 // * When Chrome OS has applied a system update, a reboot may become necessary 37 // * When Chrome OS has applied a system update, a reboot may become necessary
35 // to complete the update process. If the policy to automatically reboot after 38 // to complete the update process. If the policy to automatically reboot after
36 // an update is enabled, a reboot is scheduled at that point. 39 // an update is enabled, a reboot is scheduled at that point.
37 // * If an uptime limit is set through policy, a reboot is scheduled when the 40 // * If an uptime limit is set through policy, a reboot is scheduled when the
38 // device's uptime reaches the limit. Time spent sleeping counts as uptime as 41 // device's uptime reaches the limit. Time spent sleeping counts as uptime as
39 // well. 42 // well.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 bool has_boot_time; 86 bool has_boot_time;
84 base::TimeTicks boot_time; 87 base::TimeTicks boot_time;
85 88
86 bool has_update_reboot_needed_time; 89 bool has_update_reboot_needed_time;
87 base::TimeTicks update_reboot_needed_time; 90 base::TimeTicks update_reboot_needed_time;
88 }; 91 };
89 92
90 explicit AutomaticRebootManager(scoped_ptr<base::TickClock> clock); 93 explicit AutomaticRebootManager(scoped_ptr<base::TickClock> clock);
91 virtual ~AutomaticRebootManager(); 94 virtual ~AutomaticRebootManager();
92 95
96 void AddObserver(AutomaticRebootManagerObserver* observer);
97 void RemoveObserver(AutomaticRebootManagerObserver* observer);
98
93 // PowerManagerClient::Observer: 99 // PowerManagerClient::Observer:
94 virtual void SystemResumed(const base::TimeDelta& sleep_duration) OVERRIDE; 100 virtual void SystemResumed(const base::TimeDelta& sleep_duration) OVERRIDE;
95 101
96 // UpdateEngineClient::Observer: 102 // UpdateEngineClient::Observer:
97 virtual void UpdateStatusChanged( 103 virtual void UpdateStatusChanged(
98 const UpdateEngineClient::Status& status) OVERRIDE; 104 const UpdateEngineClient::Status& status) OVERRIDE;
99 105
100 // ash::UserActivityObserver: 106 // ash::UserActivityObserver:
101 virtual void OnUserActivity() OVERRIDE; 107 virtual void OnUserActivity() OVERRIDE;
102 108
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 159
154 // Whether a reboot has been requested. 160 // Whether a reboot has been requested.
155 bool reboot_requested_; 161 bool reboot_requested_;
156 162
157 // Timers that start and end the grace period. 163 // Timers that start and end the grace period.
158 scoped_ptr<base::OneShotTimer<AutomaticRebootManager> > grace_start_timer_; 164 scoped_ptr<base::OneShotTimer<AutomaticRebootManager> > grace_start_timer_;
159 scoped_ptr<base::OneShotTimer<AutomaticRebootManager> > grace_end_timer_; 165 scoped_ptr<base::OneShotTimer<AutomaticRebootManager> > grace_end_timer_;
160 166
161 base::WeakPtrFactory<AutomaticRebootManager> weak_ptr_factory_; 167 base::WeakPtrFactory<AutomaticRebootManager> weak_ptr_factory_;
162 168
169 ObserverList<AutomaticRebootManagerObserver, true> observers_;
170
163 DISALLOW_COPY_AND_ASSIGN(AutomaticRebootManager); 171 DISALLOW_COPY_AND_ASSIGN(AutomaticRebootManager);
164 }; 172 };
165 173
166 } // namespace system 174 } // namespace system
167 } // namespace chromeos 175 } // namespace chromeos
168 176
169 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_ 177 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_AUTOMATIC_REBOOT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.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