| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "google_apis/gcm/base/gcm_export.h" | 9 #include "google_apis/gcm/base/gcm_export.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 ConnectionHandler(); | 42 ConnectionHandler(); |
| 43 virtual ~ConnectionHandler(); | 43 virtual ~ConnectionHandler(); |
| 44 | 44 |
| 45 // Starts a new MCS connection handshake (using |login_request|) and, upon | 45 // Starts a new MCS connection handshake (using |login_request|) and, upon |
| 46 // success, begins listening for incoming/outgoing messages. | 46 // success, begins listening for incoming/outgoing messages. |
| 47 // | 47 // |
| 48 // Note: It is correct and expected to call Init more than once, as connection | 48 // Note: It is correct and expected to call Init more than once, as connection |
| 49 // issues are encountered and new connections must be made. | 49 // issues are encountered and new connections must be made. |
| 50 virtual void Init(const mcs_proto::LoginRequest& login_request, | 50 virtual void Init(const mcs_proto::LoginRequest& login_request, |
| 51 scoped_ptr<net::StreamSocket> socket) = 0; | 51 net::StreamSocket* socket) = 0; |
| 52 | 52 |
| 53 // Checks that a handshake has been completed and a message is not already | 53 // Checks that a handshake has been completed and a message is not already |
| 54 // in flight. | 54 // in flight. |
| 55 virtual bool CanSendMessage() const = 0; | 55 virtual bool CanSendMessage() const = 0; |
| 56 | 56 |
| 57 // Send an MCS protobuf message. CanSendMessage() must be true. | 57 // Send an MCS protobuf message. CanSendMessage() must be true. |
| 58 virtual void SendMessage(const google::protobuf::MessageLite& message) = 0; | 58 virtual void SendMessage(const google::protobuf::MessageLite& message) = 0; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace gcm | 61 } // namespace gcm |
| 62 | 62 |
| 63 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ | 63 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ |
| OLD | NEW |