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

Side by Side Diff: powerd.cc

Issue 2689004: Convert 'char *' to 'char*' throughout power manager. (Closed) Base URL: ssh://git@chromiumos-git/power_manager.git
Patch Set: Created 10 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
OLDNEW
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 #include "power_manager/powerd.h" 5 #include "power_manager/powerd.h"
6 6
7 #include <dbus/dbus-glib-lowlevel.h> 7 #include <dbus/dbus-glib-lowlevel.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <sys/wait.h> 9 #include <sys/wait.h>
10 #include <X11/extensions/dpms.h> 10 #include <X11/extensions/dpms.h>
(...skipping 11 matching lines...) Expand all
22 22
23 namespace power_manager { 23 namespace power_manager {
24 24
25 // The minimum delta between timers to avoid timer precision issues 25 // The minimum delta between timers to avoid timer precision issues
26 static const int64 kFuzzMS = 100; 26 static const int64 kFuzzMS = 100;
27 27
28 // The minimum delta between timers when we want to give a user time to react 28 // The minimum delta between timers when we want to give a user time to react
29 static const int64 kReactMS = 30000; 29 static const int64 kReactMS = 30000;
30 30
31 // Lock the screen 31 // Lock the screen
32 static void SendSignalToSessionManager(const char *signal) { 32 static void SendSignalToSessionManager(const char* signal) {
33 DBusGProxy *proxy = dbus_g_proxy_new_for_name( 33 DBusGProxy* proxy = dbus_g_proxy_new_for_name(
34 chromeos::dbus::GetSystemBusConnection().g_connection(), 34 chromeos::dbus::GetSystemBusConnection().g_connection(),
35 login_manager::kSessionManagerServiceName, 35 login_manager::kSessionManagerServiceName,
36 login_manager::kSessionManagerServicePath, 36 login_manager::kSessionManagerServicePath,
37 login_manager::kSessionManagerInterface); 37 login_manager::kSessionManagerInterface);
38 CHECK(proxy); 38 CHECK(proxy);
39 GError *error = NULL; 39 GError* error = NULL;
40 if (!dbus_g_proxy_call(proxy, signal, &error, G_TYPE_INVALID, 40 if (!dbus_g_proxy_call(proxy, signal, &error, G_TYPE_INVALID,
41 G_TYPE_INVALID)) { 41 G_TYPE_INVALID)) {
42 LOG(ERROR) << "Error sending signal: " << error->message; 42 LOG(ERROR) << "Error sending signal: " << error->message;
43 } 43 }
44 g_object_unref(proxy); 44 g_object_unref(proxy);
45 } 45 }
46 46
47 // A message filter to receive signals. 47 // A message filter to receive signals.
48 static DBusHandlerResult DBusMessageHandler(DBusConnection*, 48 static DBusHandlerResult DBusMessageHandler(DBusConnection*,
49 DBusMessage* message, 49 DBusMessage* message,
50 void*) { 50 void*) {
tfarina 2010/06/05 01:08:56 I know we are not using this paramenter, but would
51 if (dbus_message_is_signal(message, kPowerManagerInterface, 51 if (dbus_message_is_signal(message, kPowerManagerInterface,
52 kRequestLockScreenSignal)) { 52 kRequestLockScreenSignal)) {
53 LOG(INFO) << "RequestLockScreen event"; 53 LOG(INFO) << "RequestLockScreen event";
54 SendSignalToSessionManager("LockScreen"); 54 SendSignalToSessionManager("LockScreen");
55 } else if (dbus_message_is_signal(message, kPowerManagerInterface, 55 } else if (dbus_message_is_signal(message, kPowerManagerInterface,
56 kRequestUnlockScreenSignal)) { 56 kRequestUnlockScreenSignal)) {
57 LOG(INFO) << "RequestUnlockScreen event"; 57 LOG(INFO) << "RequestUnlockScreen event";
58 SendSignalToSessionManager("UnlockScreen"); 58 SendSignalToSessionManager("UnlockScreen");
59 } else if (dbus_message_is_signal(message, kPowerManagerInterface, 59 } else if (dbus_message_is_signal(message, kPowerManagerInterface,
60 kScreenIsLockedSignal)) { 60 kScreenIsLockedSignal)) {
(...skipping 14 matching lines...) Expand all
75 pid_t pid = fork(); 75 pid_t pid = fork();
76 if (pid == 0) { 76 if (pid == 0) {
77 // Detach from parent so that powerd doesn't need to wait around for us 77 // Detach from parent so that powerd doesn't need to wait around for us
78 setsid(); 78 setsid();
79 exit(fork() == 0 ? system(cmd) : 0); 79 exit(fork() == 0 ? system(cmd) : 0);
80 } else if (pid > 0) { 80 } else if (pid > 0) {
81 waitpid(pid, NULL, 0); 81 waitpid(pid, NULL, 0);
82 } 82 }
83 } 83 }
84 84
85 static void RegisterDBusMessageHandler(Daemon *object) { 85 static void RegisterDBusMessageHandler(Daemon* object) {
86 const std::string filter = StringPrintf("type='signal', interface='%s'", 86 const std::string filter = StringPrintf("type='signal', interface='%s'",
87 kPowerManagerInterface); 87 kPowerManagerInterface);
88 88
89 DBusError error; 89 DBusError error;
90 dbus_error_init(&error); 90 dbus_error_init(&error);
91 DBusConnection* connection = dbus_g_connection_get_connection( 91 DBusConnection* connection = dbus_g_connection_get_connection(
92 chromeos::dbus::GetSystemBusConnection().g_connection()); 92 chromeos::dbus::GetSystemBusConnection().g_connection());
93 dbus_bus_add_match(connection, filter.c_str(), &error); 93 dbus_bus_add_match(connection, filter.c_str(), &error);
94 if (dbus_error_is_set(&error)) { 94 if (dbus_error_is_set(&error)) {
95 LOG(ERROR) << "Failed to add a filter:" << error.name << ", message=" 95 LOG(ERROR) << "Failed to add a filter:" << error.name << ", message="
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 LOG(INFO) << "Key press: Brightness up"; 290 LOG(INFO) << "Key press: Brightness up";
291 } else if (xevent->xkey.keycode == daemon->key_brightness_down_) { 291 } else if (xevent->xkey.keycode == daemon->key_brightness_down_) {
292 LOG(INFO) << "Key press: Brightness down"; 292 LOG(INFO) << "Key press: Brightness down";
293 } else { 293 } else {
294 return GDK_FILTER_CONTINUE; 294 return GDK_FILTER_CONTINUE;
295 } 295 }
296 daemon->ctl_->ReadBrightness(); 296 daemon->ctl_->ReadBrightness();
297 } 297 }
298 return GDK_FILTER_CONTINUE; 298 return GDK_FILTER_CONTINUE;
299 } 299 }
300 300
tfarina 2010/06/05 01:08:56 remove this blank line;
301 301
302 } // namespace power_manager 302 } // namespace power_manager
OLDNEW
« power_prefs_interface.h ('K') | « power_prefs_interface.h ('k') | powerd_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698