summaryrefslogtreecommitdiffstats
path: root/chromeos/display/output_configurator.h
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 05:24:07 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 05:24:07 +0000
commit8405db533878bac39d622c421e8c1baa9d21c0fe (patch)
tree2c60a7f67b3a5d20c358e6f10c57a66e574e8bbc /chromeos/display/output_configurator.h
parentdce8642ab3068e41c3ce0a46571498dbd270921d (diff)
downloadchromium_src-8405db533878bac39d622c421e8c1baa9d21c0fe.zip
chromium_src-8405db533878bac39d622c421e8c1baa9d21c0fe.tar.gz
chromium_src-8405db533878bac39d622c421e8c1baa9d21c0fe.tar.bz2
chromeos: Add DisplayPowerServiceProvider.
This makes Chrome export a SetDisplayPower D-Bus method call for the power manager. It also reworks OutputConfigurator to cache the most-recently-requested power state and use it for future display mode requests. Finally, it works around a related bug where multiple mouse events may be generated when the displays are reconfigured, which would result in a report of user activity that could abort suspending. BUG=chromium-os:39289,180348,chrome-os-partner:12662 TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/12391004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/display/output_configurator.h')
-rw-r--r--chromeos/display/output_configurator.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index 804f856..4f93598 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -14,6 +14,7 @@
#include "base/message_loop.h"
#include "base/timer.h"
#include "chromeos/chromeos_export.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
// Forward declarations for Xlib and Xrandr.
// This is so unused X definitions don't pollute the namespace.
@@ -86,7 +87,9 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// Called when powerd notifies us that some set of displays should be turned
// on or off. This requires enabling or disabling the CRTC associated with
// the display(s) in question so that the low power state is engaged.
- bool ScreenPowerSet(bool power_on, bool all_displays);
+ // If |force_probe| is true, the displays will be configured even if
+ // |power_state| matches |power_state_|.
+ bool SetDisplayPower(DisplayPowerState power_state, bool force_probe);
// Force switching the display mode to |new_state|. This method is used when
// the user explicitly changes the display mode in the options UI. Returns
@@ -106,11 +109,15 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// Tells if the output specified by |name| is for internal display.
static bool IsInternalOutputName(const std::string& name);
- // Set all the displays into pre-suspend mode; usually this means configure
- // them for their resume state. This allows faster resume on machines where
- // display configuration is slow.
+ // Sets all the displays into pre-suspend mode; usually this means
+ // configure them for their resume state. This allows faster resume on
+ // machines where display configuration is slow.
void SuspendDisplays();
+ // Reprobes displays to handle changes made while the system was
+ // suspended.
+ void ResumeDisplays();
+
private:
// Configure outputs.
void ConfigureOutputs();
@@ -156,15 +163,15 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
XRRScreenResources* screen,
std::vector<OutputSnapshot>& outputs);
- // Configures X to the state specified in |new_state|.
- // |display|, |screen| and |window| are used to change X configuration.
- // |new_state| is the state to enter.
- // |outputs| contains information on the currently configured state,
- // as well as how to apply the new state.
+ // Configures X to the state specified in |output_state| and
+ // |power_state|. |display|, |screen| and |window| are used to change X
+ // configuration. |outputs| contains information on the currently
+ // configured state, as well as how to apply the new state.
bool EnterState(Display* display,
XRRScreenResources* screen,
Window window,
- OutputState new_state,
+ OutputState output_state,
+ DisplayPowerState power_state,
const std::vector<OutputSnapshot>& outputs);
// Outputs UMA metrics of previous state (the state that is being left).
@@ -199,6 +206,9 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// This is used for rotating display modes.
OutputState output_state_;
+ // The current power state as set via SetDisplayPower().
+ DisplayPowerState power_state_;
+
ObserverList<Observer> observers_;
// The timer to delay configuring outputs. See also the comments in