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

Side by Side Diff: content/browser/power_save_blocker_linux.cc

Issue 10441028: aura/cros: Rename MessagePump{X => AuraX11} and move the atom cache into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error in file added in the interim Created 8 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 | Annotate | Revision Log
OLDNEW
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.h" 5 #include "content/browser/power_save_blocker.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/file_path.h" 19 #include "base/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_proxy.h" 24 #include "base/message_loop_proxy.h"
25 #if defined(TOOLKIT_GTK) 25 #if defined(TOOLKIT_GTK)
26 #include "base/message_pump_gtk.h" 26 #include "base/message_pump_gtk.h"
27 #else 27 #else
28 #include "base/message_pump_x.h" 28 #include "base/message_pump_aurax11.h"
29 #endif 29 #endif
30 #include "base/nix/xdg_util.h" 30 #include "base/nix/xdg_util.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "dbus/bus.h" 32 #include "dbus/bus.h"
33 #include "dbus/message.h" 33 #include "dbus/message.h"
34 #include "dbus/object_path.h" 34 #include "dbus/object_path.h"
35 #include "dbus/object_proxy.h" 35 #include "dbus/object_proxy.h"
36 36
37 using content::BrowserThread; 37 using content::BrowserThread;
38 38
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // Connection to D-Bus is just a Unix domain socket, which is not 474 // Connection to D-Bus is just a Unix domain socket, which is not
475 // a persistent resource, hence the operating system will take care 475 // a persistent resource, hence the operating system will take care
476 // of closing it when the process terminates. 476 // of closing it when the process terminates.
477 if (BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { 477 if (BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) {
478 bus_->ShutdownOnDBusThreadAndBlock(); 478 bus_->ShutdownOnDBusThreadAndBlock();
479 } 479 }
480 } 480 }
481 481
482 // static 482 // static
483 bool DBusPowerSaveBlocker::DPMSEnabled() { 483 bool DBusPowerSaveBlocker::DPMSEnabled() {
484 #if defined(TOOLKIT_GTK) 484 Display* display = base::MessagePumpForUI::GetDefaultXDisplay();
485 Display* display = base::MessagePumpGtk::GetDefaultXDisplay();
486 #else
487 Display* display = base::MessagePumpX::GetDefaultXDisplay();
488 #endif
489 BOOL enabled = false; 485 BOOL enabled = false;
490 int dummy; 486 int dummy;
491 if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { 487 if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) {
492 CARD16 state; 488 CARD16 state;
493 DPMSInfo(display, &state, &enabled); 489 DPMSInfo(display, &state, &enabled);
494 } 490 }
495 return enabled; 491 return enabled;
496 } 492 }
497 493
498 // static 494 // static
499 DBusPowerSaveBlocker* DBusPowerSaveBlocker::GetInstance() { 495 DBusPowerSaveBlocker* DBusPowerSaveBlocker::GetInstance() {
500 return Singleton<DBusPowerSaveBlocker>::get(); 496 return Singleton<DBusPowerSaveBlocker>::get();
501 } 497 }
502 498
503 } // namespace 499 } // namespace
504 500
505 // Called only from UI thread. 501 // Called only from UI thread.
506 // static 502 // static
507 void PowerSaveBlocker::ApplyBlock(PowerSaveBlockerType type) { 503 void PowerSaveBlocker::ApplyBlock(PowerSaveBlockerType type) {
508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 504 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
509 DBusPowerSaveBlocker::GetInstance()->ApplyBlock(type); 505 DBusPowerSaveBlocker::GetInstance()->ApplyBlock(type);
510 } 506 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698