OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 5 #ifndef CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ |
6 #define CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 6 #define CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 // This class exports "SetDisplayPower" and "SetDisplaySoftwareDimming" | 26 // This class exports "SetDisplayPower" and "SetDisplaySoftwareDimming" |
27 // D-Bus methods that the power manager calls to instruct Chrome to turn | 27 // D-Bus methods that the power manager calls to instruct Chrome to turn |
28 // various displays on or off or dim them. | 28 // various displays on or off or dim them. |
29 class CHROMEOS_EXPORT DisplayPowerServiceProvider | 29 class CHROMEOS_EXPORT DisplayPowerServiceProvider |
30 : public CrosDBusService::ServiceProviderInterface { | 30 : public CrosDBusService::ServiceProviderInterface { |
31 public: | 31 public: |
32 class Delegate { | 32 class Delegate { |
33 public: | 33 public: |
| 34 typedef base::Callback<void(bool)> ResponseCallback; |
| 35 |
34 virtual ~Delegate() {} | 36 virtual ~Delegate() {} |
35 | 37 |
36 // Sets the display power state. | 38 // Sets the display power state. After the display power is set, |callback| |
37 virtual void SetDisplayPower(DisplayPowerState power_state) = 0; | 39 // is called with the operation status. |
| 40 virtual void SetDisplayPower(DisplayPowerState power_state, |
| 41 const ResponseCallback& callback) = 0; |
38 | 42 |
39 // Dims or undims the screen. | 43 // Dims or undims the screen. |
40 virtual void SetDimming(bool dimmed) = 0; | 44 virtual void SetDimming(bool dimmed) = 0; |
41 }; | 45 }; |
42 | 46 |
43 explicit DisplayPowerServiceProvider(scoped_ptr<Delegate> delegate); | 47 explicit DisplayPowerServiceProvider(scoped_ptr<Delegate> delegate); |
44 ~DisplayPowerServiceProvider() override; | 48 ~DisplayPowerServiceProvider() override; |
45 | 49 |
46 // CrosDBusService::ServiceProviderInterface overrides: | 50 // CrosDBusService::ServiceProviderInterface overrides: |
47 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; | 51 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; |
(...skipping 17 matching lines...) Expand all Loading... |
65 // Keep this last so that all weak pointers will be invalidated at the | 69 // Keep this last so that all weak pointers will be invalidated at the |
66 // beginning of destruction. | 70 // beginning of destruction. |
67 base::WeakPtrFactory<DisplayPowerServiceProvider> weak_ptr_factory_; | 71 base::WeakPtrFactory<DisplayPowerServiceProvider> weak_ptr_factory_; |
68 | 72 |
69 DISALLOW_COPY_AND_ASSIGN(DisplayPowerServiceProvider); | 73 DISALLOW_COPY_AND_ASSIGN(DisplayPowerServiceProvider); |
70 }; | 74 }; |
71 | 75 |
72 } // namespace chromeos | 76 } // namespace chromeos |
73 | 77 |
74 #endif // CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 78 #endif // CHROMEOS_DBUS_SERVICES_DISPLAY_POWER_SERVICE_PROVIDER_H_ |
OLD | NEW |