| 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_FAKE_POWER_MANAGER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 int num_set_is_projecting_calls() const { | 35 int num_set_is_projecting_calls() const { |
| 36 return num_set_is_projecting_calls_; | 36 return num_set_is_projecting_calls_; |
| 37 } | 37 } |
| 38 bool is_projecting() const { return is_projecting_; } | 38 bool is_projecting() const { return is_projecting_; } |
| 39 bool have_video_activity_report() const { | 39 bool have_video_activity_report() const { |
| 40 return !video_activity_reports_.empty(); | 40 return !video_activity_reports_.empty(); |
| 41 } | 41 } |
| 42 int num_set_backlights_forced_off_calls() const { | 42 int num_set_backlights_forced_off_calls() const { |
| 43 return num_set_backlights_forced_off_calls_; | 43 return num_set_backlights_forced_off_calls_; |
| 44 } | 44 } |
| 45 | |
| 46 void set_lid_state(LidState state) { lid_state_ = state; } | |
| 47 void set_tablet_mode(TabletMode mode) { tablet_mode_ = mode; } | 45 void set_tablet_mode(TabletMode mode) { tablet_mode_ = mode; } |
| 48 | 46 |
| 49 // PowerManagerClient overrides | 47 // PowerManagerClient overrides |
| 50 void Init(dbus::Bus* bus) override; | 48 void Init(dbus::Bus* bus) override; |
| 51 void AddObserver(Observer* observer) override; | 49 void AddObserver(Observer* observer) override; |
| 52 void RemoveObserver(Observer* observer) override; | 50 void RemoveObserver(Observer* observer) override; |
| 53 bool HasObserver(const Observer* observer) const override; | 51 bool HasObserver(const Observer* observer) const override; |
| 54 void SetRenderProcessManagerDelegate( | 52 void SetRenderProcessManagerDelegate( |
| 55 base::WeakPtr<RenderProcessManagerDelegate> delegate) override; | 53 base::WeakPtr<RenderProcessManagerDelegate> delegate) override; |
| 56 void DecreaseScreenBrightness(bool allow_off) override; | 54 void DecreaseScreenBrightness(bool allow_off) override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 86 void SendSuspendDone(); | 84 void SendSuspendDone(); |
| 87 void SendDarkSuspendImminent(); | 85 void SendDarkSuspendImminent(); |
| 88 | 86 |
| 89 // Emulates the power manager announcing that the system is changing | 87 // Emulates the power manager announcing that the system is changing |
| 90 // brightness to |level|. | 88 // brightness to |level|. |
| 91 void SendBrightnessChanged(int level, bool user_initiated); | 89 void SendBrightnessChanged(int level, bool user_initiated); |
| 92 | 90 |
| 93 // Notifies observers that the power button has been pressed or released. | 91 // Notifies observers that the power button has been pressed or released. |
| 94 void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 92 void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
| 95 | 93 |
| 94 // Sets |lid_state_| and notifies |observers_| about the change. |
| 95 void SetLidState(LidState state, const base::TimeTicks& timestamp); |
| 96 |
| 96 // Updates |props_| and notifies observers of its changes. | 97 // Updates |props_| and notifies observers of its changes. |
| 97 void UpdatePowerProperties( | 98 void UpdatePowerProperties( |
| 98 const power_manager::PowerSupplyProperties& power_props); | 99 const power_manager::PowerSupplyProperties& power_props); |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 // Callback that will be run by asynchronous suspend delays to report | 102 // Callback that will be run by asynchronous suspend delays to report |
| 102 // readiness. | 103 // readiness. |
| 103 void HandleSuspendReadiness(); | 104 void HandleSuspendReadiness(); |
| 104 | 105 |
| 105 // Notifies |observers_| that |props_| has been updated. | 106 // Notifies |observers_| that |props_| has been updated. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Note: This should remain the last member so it'll be destroyed and | 145 // Note: This should remain the last member so it'll be destroyed and |
| 145 // invalidate its weak pointers before any other members are destroyed. | 146 // invalidate its weak pointers before any other members are destroyed. |
| 146 base::WeakPtrFactory<FakePowerManagerClient> weak_ptr_factory_; | 147 base::WeakPtrFactory<FakePowerManagerClient> weak_ptr_factory_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); | 149 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace chromeos | 152 } // namespace chromeos |
| 152 | 153 |
| 153 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 154 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |