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

Unified Diff: chrome/browser/chromeos/power/screen_dimming_observer.cc

Issue 10263011: chromeos: Add support for dimming the screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/power/screen_dimming_observer.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/power/screen_dimming_observer.cc
diff --git a/chrome/browser/chromeos/power/screen_dimming_observer.cc b/chrome/browser/chromeos/power/screen_dimming_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7795760c279ae87c036d9873356edd1b30395874
--- /dev/null
+++ b/chrome/browser/chromeos/power/screen_dimming_observer.cc
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/power/screen_dimming_observer.h"
+
+#include "ash/shell.h"
+#include "ash/wm/screen_dimmer.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+
+namespace chromeos {
+
+ScreenDimmingObserver::ScreenDimmingObserver() {
+ DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
+}
+
+ScreenDimmingObserver::~ScreenDimmingObserver() {
+ DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
+}
+
+void ScreenDimmingObserver::ScreenDimmingRequested(ScreenDimmingState state) {
+ ash::Shell::GetInstance()->screen_dimmer()->SetDimming(
+ state == PowerManagerClient::Observer::SCREEN_DIMMING_IDLE);
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/power/screen_dimming_observer.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698