| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "components/cryptauth/fake_connection.h" |
| 10 #include "components/cryptauth/remote_device.h" | 11 #include "components/cryptauth/remote_device.h" |
| 11 #include "components/proximity_auth/remote_device_life_cycle.h" | 12 #include "components/proximity_auth/remote_device_life_cycle.h" |
| 12 | 13 |
| 13 namespace proximity_auth { | 14 namespace proximity_auth { |
| 14 | 15 |
| 15 class FakeRemoteDeviceLifeCycle : public RemoteDeviceLifeCycle { | 16 class FakeRemoteDeviceLifeCycle : public RemoteDeviceLifeCycle { |
| 16 public: | 17 public: |
| 17 FakeRemoteDeviceLifeCycle(const cryptauth::RemoteDevice& remote_device); | 18 FakeRemoteDeviceLifeCycle(const cryptauth::RemoteDevice& remote_device); |
| 18 ~FakeRemoteDeviceLifeCycle() override; | 19 ~FakeRemoteDeviceLifeCycle() override; |
| 19 | 20 |
| 20 // RemoteDeviceLifeCycle: | 21 // RemoteDeviceLifeCycle: |
| 21 void Start() override; | 22 void Start() override; |
| 22 cryptauth::RemoteDevice GetRemoteDevice() const override; | 23 cryptauth::RemoteDevice GetRemoteDevice() const override; |
| 24 cryptauth::Connection* GetConnection() const override; |
| 23 State GetState() const override; | 25 State GetState() const override; |
| 24 Messenger* GetMessenger() override; | 26 Messenger* GetMessenger() override; |
| 25 void AddObserver(Observer* observer) override; | 27 void AddObserver(Observer* observer) override; |
| 26 void RemoveObserver(Observer* observer) override; | 28 void RemoveObserver(Observer* observer) override; |
| 27 | 29 |
| 28 // Changes state and notifies observers. | 30 // Changes state and notifies observers. |
| 29 void ChangeState(State new_state); | 31 void ChangeState(State new_state); |
| 30 | 32 |
| 31 void set_messenger(Messenger* messenger) { messenger_ = messenger; } | 33 void set_messenger(Messenger* messenger) { messenger_ = messenger; } |
| 32 | 34 |
| 35 void set_connection(cryptauth::Connection* connection) { |
| 36 connection_ = connection; |
| 37 } |
| 38 |
| 33 bool started() { return started_; } | 39 bool started() { return started_; } |
| 34 | 40 |
| 35 base::ObserverList<Observer>& observers() { return observers_; } | 41 base::ObserverList<Observer>& observers() { return observers_; } |
| 36 | 42 |
| 37 private: | 43 private: |
| 38 cryptauth::RemoteDevice remote_device_; | 44 cryptauth::RemoteDevice remote_device_; |
| 39 | 45 |
| 40 base::ObserverList<Observer> observers_; | 46 base::ObserverList<Observer> observers_; |
| 41 | 47 |
| 42 bool started_; | 48 bool started_; |
| 43 | 49 |
| 44 State state_; | 50 State state_; |
| 45 | 51 |
| 52 cryptauth::Connection* connection_; |
| 53 |
| 46 Messenger* messenger_; | 54 Messenger* messenger_; |
| 47 | 55 |
| 48 DISALLOW_COPY_AND_ASSIGN(FakeRemoteDeviceLifeCycle); | 56 DISALLOW_COPY_AND_ASSIGN(FakeRemoteDeviceLifeCycle); |
| 49 }; | 57 }; |
| 50 | 58 |
| 51 } // namespace proximity_auth | 59 } // namespace proximity_auth |
| 52 | 60 |
| 53 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H | 61 #endif // COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_IMPL_H |
| OLD | NEW |