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

Side by Side Diff: chrome/browser/chromeos/power/output_observer.cc

Issue 12391004: chromeos: Add DisplayPowerServiceProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh, TrayDisplay was including output_configurator.h on windows Created 7 years, 9 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 "chrome/browser/chromeos/power/output_observer.h" 5 #include "chrome/browser/chromeos/power/output_observer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/user_activity_detector.h" 8 #include "ash/wm/user_activity_detector.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chromeos/display/output_configurator.h" 10 #include "chromeos/display/output_configurator.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 OutputObserver::OutputObserver() { 14 OutputObserver::OutputObserver() {
15 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 15 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
16 } 16 }
17 17
18 OutputObserver::~OutputObserver() { 18 OutputObserver::~OutputObserver() {
19 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 19 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
20 } 20 }
21 21
22 void OutputObserver::ScreenPowerSet(bool power_on, bool all_displays) { 22 void OutputObserver::ScreenPowerSet(bool power_on, bool all_displays) {
23 if (!power_on && all_displays) { 23 // Turning displays off when the device becomes idle or on just before we
24 // All displays are turned off when the device becomes idle, which 24 // suspend may trigger a mouse move, which would then be incorrectly
25 // may trigger a mouse move. Let the UserActivityDetector know so 25 // reported as user activity. Let the UserActivityDetector know so that
26 // that it can ignore such events. 26 // it can ignore such events.
27 ash::Shell::GetInstance()->user_activity_detector()-> 27 ash::Shell::GetInstance()->user_activity_detector()->OnDisplayPowerChanging();
28 OnAllOutputsTurnedOff();
29 }
30 28
31 ash::Shell::GetInstance()->output_configurator()-> 29 DisplayPowerState state = DISPLAY_POWER_ALL_ON;
32 ScreenPowerSet(power_on, all_displays); 30 if (power_on && all_displays)
31 state = DISPLAY_POWER_ALL_ON;
32 else if (power_on && !all_displays)
33 state = DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF;
34 else if (!power_on && all_displays)
35 state = DISPLAY_POWER_ALL_OFF;
36 else if (!power_on && !all_displays)
37 state = DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON;
38
39 ash::Shell::GetInstance()->output_configurator()->SetDisplayPower(
40 state, false);
33 } 41 }
34 42
35 } // namespace chromeos 43 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/output_observer.h ('k') | chrome/browser/chromeos/power/resume_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698