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 REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ | 5 #ifndef REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ |
6 #define REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ | 6 #define REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "remoting/proto/control.pb.h" | 10 #include "remoting/proto/control.pb.h" |
11 #include "remoting/protocol/connection_to_host.h" | 11 #include "remoting/protocol/connection_to_host.h" |
12 #include "remoting/protocol/errors.h" | 12 #include "remoting/protocol/errors.h" |
13 #include "remoting/protocol/transport.h" | 13 #include "remoting/protocol/transport.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 namespace test { | 16 namespace test { |
17 | 17 |
18 // Interface for a remote connection observer which will be notified when | 18 // Interface for a remote connection observer which will be notified when |
19 // certain connection status changes occur or events from the remote host | 19 // certain connection status changes occur or events from the remote host |
20 // are received. Observers must not tear-down the object they have registered | 20 // are received. Observers must not tear-down the object they have registered |
21 // while in a callback. The callbacks should be used for informational | 21 // while in a callback. The callbacks should be used for informational |
22 // purposes only. | 22 // purposes only. |
23 class RemoteConnectionObserver { | 23 class RemoteConnectionObserver { |
24 public: | 24 public: |
25 RemoteConnectionObserver() {} | |
26 virtual ~RemoteConnectionObserver() {} | 25 virtual ~RemoteConnectionObserver() {} |
27 | 26 |
28 // Called when the connection state has changed. | 27 // Called when the connection state has changed. |
29 virtual void ConnectionStateChanged(protocol::ConnectionToHost::State state, | 28 virtual void ConnectionStateChanged(protocol::ConnectionToHost::State state, |
30 protocol::ErrorCode error_code) {} | 29 protocol::ErrorCode error_code) {} |
31 | 30 |
32 // Called when the connection is ready to be used, |ready| will be true once | 31 // Called when the connection is ready to be used, |ready| will be true once |
33 // the video channel has been established. | 32 // the video channel has been established. |
34 virtual void ConnectionReady(bool ready) {} | 33 virtual void ConnectionReady(bool ready) {} |
35 | 34 |
36 // Called when a channel changes the type of route it is using. | 35 // Called when a channel changes the type of route it is using. |
37 virtual void RouteChanged(const std::string& channel_name, | 36 virtual void RouteChanged(const std::string& channel_name, |
38 const protocol::TransportRoute& route) {} | 37 const protocol::TransportRoute& route) {} |
39 | 38 |
40 // Called when the host sends its list of capabilities to the client. | 39 // Called when the host sends its list of capabilities to the client. |
41 virtual void CapabilitiesSet(const std::string& capabilities) {} | 40 virtual void CapabilitiesSet(const std::string& capabilities) {} |
42 | 41 |
43 // Called when a pairing response has been set. | 42 // Called when a pairing response has been set. |
44 virtual void PairingResponseSet( | 43 virtual void PairingResponseSet( |
45 const protocol::PairingResponse& pairing_response) {} | 44 const protocol::PairingResponse& pairing_response) {} |
46 | 45 |
47 // Called when we have received an ExtensionMessage from the host. | 46 // Called when we have received an ExtensionMessage from the host. |
48 virtual void HostMessageReceived(const protocol::ExtensionMessage& message) {} | 47 virtual void HostMessageReceived(const protocol::ExtensionMessage& message) {} |
49 | 48 |
| 49 protected: |
| 50 RemoteConnectionObserver() {} |
| 51 |
50 private: | 52 private: |
51 DISALLOW_COPY_AND_ASSIGN(RemoteConnectionObserver); | 53 DISALLOW_COPY_AND_ASSIGN(RemoteConnectionObserver); |
52 }; | 54 }; |
53 | 55 |
54 } // namespace test | 56 } // namespace test |
55 } // namespace remoting | 57 } // namespace remoting |
56 | 58 |
57 #endif // REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ | 59 #endif // REMOTING_TEST_REMOTE_CONNECTION_OBSERVER_H_ |
OLD | NEW |