| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONNECTION_OBSERVER_H | 5 #ifndef COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_CONNECTION_OBSERVER_H | 6 #define COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H |
| 7 | 7 |
| 8 #include "components/proximity_auth/connection.h" | 8 #include "components/cryptauth/connection.h" |
| 9 | 9 |
| 10 namespace proximity_auth { | 10 namespace cryptauth { |
| 11 | 11 |
| 12 class WireMessage; | 12 class WireMessage; |
| 13 | 13 |
| 14 // An interface for observing events that happen on a Connection. | 14 // An interface for observing events that happen on a Connection. |
| 15 class ConnectionObserver { | 15 class ConnectionObserver { |
| 16 public: | 16 public: |
| 17 virtual ~ConnectionObserver() {} | 17 virtual ~ConnectionObserver() {} |
| 18 | 18 |
| 19 // Called when the |connection|'s status changes from |old_status| to | 19 // Called when the |connection|'s status changes from |old_status| to |
| 20 // |new_status|. The |connectoin| is guaranteed to be non-null. | 20 // |new_status|. The |connectoin| is guaranteed to be non-null. |
| 21 virtual void OnConnectionStatusChanged(Connection* connection, | 21 virtual void OnConnectionStatusChanged(Connection* connection, |
| 22 Connection::Status old_status, | 22 Connection::Status old_status, |
| 23 Connection::Status new_status) {} | 23 Connection::Status new_status) {} |
| 24 | 24 |
| 25 // Called when a |message| is received from a remote device over the | 25 // Called when a |message| is received from a remote device over the |
| 26 // |connection|. | 26 // |connection|. |
| 27 virtual void OnMessageReceived(const Connection& connection, | 27 virtual void OnMessageReceived(const Connection& connection, |
| 28 const WireMessage& message) {} | 28 const WireMessage& message) {} |
| 29 | 29 |
| 30 // Called after a |message| is sent to the remote device over the | 30 // Called after a |message| is sent to the remote device over the |
| 31 // |connection|. |success| is |true| iff the message is sent successfully. | 31 // |connection|. |success| is |true| iff the message is sent successfully. |
| 32 virtual void OnSendCompleted(const Connection& connection, | 32 virtual void OnSendCompleted(const Connection& connection, |
| 33 const WireMessage& message, | 33 const WireMessage& message, |
| 34 bool success) {} | 34 bool success) {} |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 } // namespace proximity_auth | 37 } // namespace cryptauth |
| 38 | 38 |
| 39 #endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_OBSERVER_H | 39 #endif // COMPONENTS_CRYPTAUTH_CONNECTION_OBSERVER_H |
| OLD | NEW |