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 |
11 #undef Status | 11 #undef Status |
12 #endif | 12 #endif |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/environment.h" | 18 #include "base/environment.h" |
19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
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/message_loop/message_pump_x11.h" |
25 #include "base/nix/xdg_util.h" | 26 #include "base/nix/xdg_util.h" |
26 #include "base/synchronization/lock.h" | 27 #include "base/synchronization/lock.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "dbus/bus.h" | 29 #include "dbus/bus.h" |
29 #include "dbus/message.h" | 30 #include "dbus/message.h" |
30 #include "dbus/object_path.h" | 31 #include "dbus/object_path.h" |
31 #include "dbus/object_proxy.h" | 32 #include "dbus/object_proxy.h" |
32 #include "ui/gfx/x/x11_types.h" | 33 #include "ui/gfx/x/x11_types.h" |
33 | 34 |
34 #if defined(TOOLKIT_GTK) | |
35 #include "base/message_loop/message_pump_gtk.h" | |
36 #else | |
37 #include "base/message_loop/message_pump_x11.h" | |
38 #endif | |
39 | |
40 namespace { | 35 namespace { |
41 | 36 |
42 enum DBusAPI { | 37 enum DBusAPI { |
43 NO_API, // Disable. No supported API available. | 38 NO_API, // Disable. No supported API available. |
44 GNOME_API, // Use the GNOME API. (Supports more features.) | 39 GNOME_API, // Use the GNOME API. (Supports more features.) |
45 FREEDESKTOP_API, // Use the FreeDesktop API, for KDE4 and XFCE. | 40 FREEDESKTOP_API, // Use the FreeDesktop API, for KDE4 and XFCE. |
46 }; | 41 }; |
47 | 42 |
48 // Inhibit flags defined in the org.gnome.SessionManager interface. | 43 // Inhibit flags defined in the org.gnome.SessionManager interface. |
49 // Can be OR'd together and passed as argument to the Inhibit() method | 44 // Can be OR'd together and passed as argument to the Inhibit() method |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 PowerSaveBlockerType type, const std::string& reason) | 330 PowerSaveBlockerType type, const std::string& reason) |
336 : delegate_(new Delegate(type, reason)) { | 331 : delegate_(new Delegate(type, reason)) { |
337 delegate_->Init(); | 332 delegate_->Init(); |
338 } | 333 } |
339 | 334 |
340 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() { | 335 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() { |
341 delegate_->CleanUp(); | 336 delegate_->CleanUp(); |
342 } | 337 } |
343 | 338 |
344 } // namespace content | 339 } // namespace content |
OLD | NEW |