Chromium Code Reviews| Index: components/proximity_auth/connection_observer.h |
| diff --git a/components/proximity_auth/connection_observer.h b/components/proximity_auth/connection_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2c5ee3d674ae2e6451c995cb38fd8c78c8293555 |
| --- /dev/null |
| +++ b/components/proximity_auth/connection_observer.h |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_PROXIMITY_AUTH_CONNECTION_OBSERVER_H |
| +#define COMPONENTS_PROXIMITY_AUTH_CONNECTION_OBSERVER_H |
| + |
| +#include "components/proximity_auth/connection.h" |
| + |
| +namespace proximity_auth { |
| + |
| +class PermitMessage; |
| + |
| +// An interface for observing events that happen on a Connection. |
| +class ConnectionObserver { |
| + public: |
| + // Called when the |connection|'s status changes from |old_status| to |
| + // |new_status|. |
| + virtual void OnConnectionStatusChanged(const Connection& connection, |
| + Connection::Status old_status, |
| + Connection::Status new_status) = 0; |
| + |
| + // Called when a |message| is received from a remote device over the |
| + // |connection|. |
| + virtual void OnMessageReceived(const Connection& connection, |
| + const PermitMessage& message) = 0; |
|
Tim Song
2014/09/05 00:30:34
Mention that |message| shouldn't be kept around (e
Ilya Sherman
2014/09/05 01:02:11
I'm not sure what the concern is. It's pretty muc
Tim Song
2014/09/05 03:10:33
It's easy to make such a mistake with Bind, since
|
| + |
| + // Called after a |message| is sent to the remote device over the |
| + // |connection|. |success| is |true| iff the message is sent successfully. |
| + virtual void OnSendCompleted(const Connection& connection, |
| + const PermitMessage& message, |
| + bool success) = 0; |
| +}; |
| + |
| +} // namespace proximity_auth |
| + |
| +#endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_OBSERVER_H |