OLD | NEW |
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 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 LOGIN_MANAGER_SYSTEM_UTILS_H_ | 5 #ifndef LOGIN_MANAGER_SYSTEM_UTILS_H_ |
6 #define LOGIN_MANAGER_SYSTEM_UTILS_H_ | 6 #define LOGIN_MANAGER_SYSTEM_UTILS_H_ |
7 | 7 |
| 8 #include <dbus/dbus.h> |
| 9 #include <dbus/dbus-glib.h> |
| 10 #include <glib.h> |
8 #include <unistd.h> | 11 #include <unistd.h> |
9 #include <string> | 12 #include <string> |
10 | 13 |
11 #include <base/basictypes.h> | 14 #include <base/basictypes.h> |
12 #include <base/stringprintf.h> | 15 #include <base/stringprintf.h> |
| 16 #include <chromeos/dbus/service_constants.h> |
13 | 17 |
14 class FilePath; | 18 class FilePath; |
15 | 19 |
16 namespace login_manager { | 20 namespace login_manager { |
17 class SystemUtils { | 21 class SystemUtils { |
18 public: | 22 public: |
19 SystemUtils(); | 23 SystemUtils(); |
20 virtual ~SystemUtils(); | 24 virtual ~SystemUtils(); |
21 | 25 |
22 // Sends |signal| to |pid|, with uid and euid set to |owner|. | 26 // Sends |signal| to |pid|, with uid and euid set to |owner|. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // API out of the session_manager. | 59 // API out of the session_manager. |
56 // http://code.google.com/p/chromium-os/issues/detail?id=5929 | 60 // http://code.google.com/p/chromium-os/issues/detail?id=5929 |
57 // | 61 // |
58 // Sends |signal_name| to power manager. | 62 // Sends |signal_name| to power manager. |
59 virtual void SendSignalToPowerManager(const char* signal_name); | 63 virtual void SendSignalToPowerManager(const char* signal_name); |
60 | 64 |
61 // Makes a best-effort attempt to append |msg| to the system log that is | 65 // Makes a best-effort attempt to append |msg| to the system log that is |
62 // persisted across stateful partition wipes. | 66 // persisted across stateful partition wipes. |
63 virtual void AppendToClobberLog(const char* msg) const; | 67 virtual void AppendToClobberLog(const char* msg) const; |
64 | 68 |
| 69 // Initializes |error| with |code| and |message|. |
| 70 virtual void SetGError(GError** error, |
| 71 ChromeOSLoginError code, |
| 72 const char* message); |
| 73 |
| 74 // Initializes |error| with |code| and |message|. |
| 75 virtual void SetAndSendGError(ChromeOSLoginError code, |
| 76 DBusGMethodInvocation* context, |
| 77 const char* message); |
| 78 |
65 private: | 79 private: |
66 // If this file exists on the next boot, the stateful partition will be wiped. | 80 // If this file exists on the next boot, the stateful partition will be wiped. |
67 static const char kResetFile[]; | 81 static const char kResetFile[]; |
68 | 82 |
69 // Sends |signal_name| to |interface, optionally adding |payload| | 83 // Sends |signal_name| to |interface, optionally adding |payload| |
70 // as an arg if it is not NULL. | 84 // as an arg if it is not NULL. |
71 static void SendSignalTo(const char* interface, | 85 static void SendSignalTo(const char* interface, |
72 const char* signal_name, | 86 const char* signal_name, |
73 const char* payload); | 87 const char* payload); |
74 | 88 |
75 DISALLOW_COPY_AND_ASSIGN(SystemUtils); | 89 DISALLOW_COPY_AND_ASSIGN(SystemUtils); |
76 }; | 90 }; |
77 } // namespace login_manager | 91 } // namespace login_manager |
78 | 92 |
79 #endif // LOGIN_MANAGER_SYSTEM_UTILS_H_ | 93 #endif // LOGIN_MANAGER_SYSTEM_UTILS_H_ |
OLD | NEW |