| 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 CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_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 14 matching lines...) Expand all Loading... |
| 25 // D-Bus methods that the power manager calls to instruct Chrome to turn | 25 // D-Bus methods that the power manager calls to instruct Chrome to turn |
| 26 // various displays on or off or dim them. | 26 // various displays on or off or dim them. |
| 27 class DisplayPowerServiceProvider | 27 class DisplayPowerServiceProvider |
| 28 : public CrosDBusService::ServiceProviderInterface { | 28 : public CrosDBusService::ServiceProviderInterface { |
| 29 public: | 29 public: |
| 30 DisplayPowerServiceProvider(); | 30 DisplayPowerServiceProvider(); |
| 31 virtual ~DisplayPowerServiceProvider(); | 31 virtual ~DisplayPowerServiceProvider(); |
| 32 | 32 |
| 33 // CrosDBusService::ServiceProviderInterface overrides: | 33 // CrosDBusService::ServiceProviderInterface overrides: |
| 34 virtual void Start( | 34 virtual void Start( |
| 35 scoped_refptr<dbus::ExportedObject> exported_object) OVERRIDE; | 35 scoped_refptr<dbus::ExportedObject> exported_object) override; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // Called from ExportedObject when a handler is exported as a D-Bus | 38 // Called from ExportedObject when a handler is exported as a D-Bus |
| 39 // method or failed to be exported. | 39 // method or failed to be exported. |
| 40 void OnExported(const std::string& interface_name, | 40 void OnExported(const std::string& interface_name, |
| 41 const std::string& method_name, | 41 const std::string& method_name, |
| 42 bool success); | 42 bool success); |
| 43 | 43 |
| 44 // Called on UI thread in response to D-Bus requests. | 44 // Called on UI thread in response to D-Bus requests. |
| 45 void SetDisplayPower(dbus::MethodCall* method_call, | 45 void SetDisplayPower(dbus::MethodCall* method_call, |
| 46 dbus::ExportedObject::ResponseSender response_sender); | 46 dbus::ExportedObject::ResponseSender response_sender); |
| 47 void SetDisplaySoftwareDimming( | 47 void SetDisplaySoftwareDimming( |
| 48 dbus::MethodCall* method_call, | 48 dbus::MethodCall* method_call, |
| 49 dbus::ExportedObject::ResponseSender response_sender); | 49 dbus::ExportedObject::ResponseSender response_sender); |
| 50 | 50 |
| 51 // Keep this last so that all weak pointers will be invalidated at the | 51 // Keep this last so that all weak pointers will be invalidated at the |
| 52 // beginning of destruction. | 52 // beginning of destruction. |
| 53 base::WeakPtrFactory<DisplayPowerServiceProvider> weak_ptr_factory_; | 53 base::WeakPtrFactory<DisplayPowerServiceProvider> weak_ptr_factory_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(DisplayPowerServiceProvider); | 55 DISALLOW_COPY_AND_ASSIGN(DisplayPowerServiceProvider); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace chromeos | 58 } // namespace chromeos |
| 59 | 59 |
| 60 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_ | 60 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DISPLAY_POWER_SERVICE_PROVIDER_H_ |
| OLD | NEW |