OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ | 5 #ifndef _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ |
6 #define _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ | 6 #define _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // Collect if there is was an unclean shutdown. Returns true if | 23 // Collect if there is was an unclean shutdown. Returns true if |
24 // there was, false otherwise. | 24 // there was, false otherwise. |
25 bool Collect(); | 25 bool Collect(); |
26 | 26 |
27 // Disable collection - signal that the system has been shutdown cleanly. | 27 // Disable collection - signal that the system has been shutdown cleanly. |
28 bool Disable(); | 28 bool Disable(); |
29 | 29 |
30 private: | 30 private: |
31 friend class UncleanShutdownCollectorTest; | 31 friend class UncleanShutdownCollectorTest; |
32 FRIEND_TEST(UncleanShutdownCollectorTest, EnableCannotWrite); | 32 FRIEND_TEST(UncleanShutdownCollectorTest, EnableCannotWrite); |
| 33 FRIEND_TEST(UncleanShutdownCollectorTest, CollectDeadBatteryRunningLow); |
| 34 FRIEND_TEST(UncleanShutdownCollectorTest, CollectDeadBatterySuspended); |
33 | 35 |
34 bool DeleteUncleanShutdownFile(); | 36 bool DeleteUncleanShutdownFiles(); |
| 37 |
| 38 // Check for unclean shutdown due to battery running out by analyzing powerd |
| 39 // trace files. |
| 40 bool CheckForDeadBatteryUncleanShutdown(); |
35 | 41 |
36 const char *unclean_shutdown_file_; | 42 const char *unclean_shutdown_file_; |
| 43 FilePath powerd_trace_path_; |
| 44 FilePath powerd_suspended_file_; |
| 45 FilePath powerd_low_battery_file_; |
37 }; | 46 }; |
38 | 47 |
39 #endif // _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ | 48 #endif // _CRASH_REPORTER_UNCLEAN_SHUTDOWN_COLLECTOR_H_ |
OLD | NEW |