OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/power_save_blocker_impl.h" | 5 #include "content/browser/power_save_blocker_impl.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/extensions/dpms.h> | 8 #include <X11/extensions/dpms.h> |
9 // Xlib #defines Status, but we can't have that for some of our headers. | 9 // Xlib #defines Status, but we can't have that for some of our headers. |
10 #ifdef Status | 10 #ifdef Status |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
23 #include "base/memory/singleton.h" | 23 #include "base/memory/singleton.h" |
24 #include "base/message_loop/message_loop_proxy.h" | 24 #include "base/message_loop/message_loop_proxy.h" |
25 #include "base/nix/xdg_util.h" | 25 #include "base/nix/xdg_util.h" |
26 #include "base/synchronization/lock.h" | 26 #include "base/synchronization/lock.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "dbus/bus.h" | 28 #include "dbus/bus.h" |
29 #include "dbus/message.h" | 29 #include "dbus/message.h" |
30 #include "dbus/object_path.h" | 30 #include "dbus/object_path.h" |
31 #include "dbus/object_proxy.h" | 31 #include "dbus/object_proxy.h" |
| 32 #include "ui/gfx/x/x11_types.h" |
32 | 33 |
33 #if defined(TOOLKIT_GTK) | 34 #if defined(TOOLKIT_GTK) |
34 #include "base/message_loop/message_pump_gtk.h" | 35 #include "base/message_loop/message_pump_gtk.h" |
35 #else | 36 #else |
36 #include "base/message_loop/message_pump_x11.h" | 37 #include "base/message_loop/message_pump_x11.h" |
37 #endif | 38 #endif |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 enum DBusAPI { | 42 enum DBusAPI { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // We don't care about checking the result. We assume it works; we can't | 292 // We don't care about checking the result. We assume it works; we can't |
292 // really do anything about it anyway if it fails. | 293 // really do anything about it anyway if it fails. |
293 inhibit_cookie_ = 0; | 294 inhibit_cookie_ = 0; |
294 | 295 |
295 bus_->ShutdownAndBlock(); | 296 bus_->ShutdownAndBlock(); |
296 bus_ = NULL; | 297 bus_ = NULL; |
297 } | 298 } |
298 | 299 |
299 // static | 300 // static |
300 bool PowerSaveBlockerImpl::Delegate::DPMSEnabled() { | 301 bool PowerSaveBlockerImpl::Delegate::DPMSEnabled() { |
301 Display* display = base::MessagePumpForUI::GetDefaultXDisplay(); | 302 XDisplay* display = base::MessagePumpForUI::GetDefaultXDisplay(); |
302 BOOL enabled = false; | 303 BOOL enabled = false; |
303 int dummy; | 304 int dummy; |
304 if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { | 305 if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { |
305 CARD16 state; | 306 CARD16 state; |
306 DPMSInfo(display, &state, &enabled); | 307 DPMSInfo(display, &state, &enabled); |
307 } | 308 } |
308 return enabled; | 309 return enabled; |
309 } | 310 } |
310 | 311 |
311 // static | 312 // static |
(...skipping 22 matching lines...) Expand all Loading... |
334 PowerSaveBlockerType type, const std::string& reason) | 335 PowerSaveBlockerType type, const std::string& reason) |
335 : delegate_(new Delegate(type, reason)) { | 336 : delegate_(new Delegate(type, reason)) { |
336 delegate_->Init(); | 337 delegate_->Init(); |
337 } | 338 } |
338 | 339 |
339 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() { | 340 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() { |
340 delegate_->CleanUp(); | 341 delegate_->CleanUp(); |
341 } | 342 } |
342 | 343 |
343 } // namespace content | 344 } // namespace content |
OLD | NEW |