| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "google_apis/gcm/base/gcm_export.h" | 11 #include "google_apis/gcm/base/gcm_export.h" |
| 12 | 12 |
| 13 namespace net{ | 13 namespace net{ |
| 14 class StreamSocket; | 14 class StreamSocket; |
| 15 } // namespace net | 15 } // namespace net |
| 16 | 16 |
| 17 namespace google { | 17 namespace google { |
| 18 namespace protobuf { | 18 namespace protobuf { |
| 19 class MessageLite; | 19 class MessageLite; |
| 20 } // namespace protobuf | 20 } // namespace protobuf |
| 21 } // namepsace google | 21 } // namepsace google |
| 22 | 22 |
| 23 namespace mcs_proto { | 23 namespace mcs_proto { |
| 24 class LoginRequest; | 24 class LoginRequest; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace gcm { | 27 namespace gcm { |
| 28 | 28 |
| 29 class SocketInputStream; | |
| 30 class SocketOutputStream; | |
| 31 | |
| 32 // Handles performing the protocol handshake and sending/receiving protobuf | 29 // Handles performing the protocol handshake and sending/receiving protobuf |
| 33 // messages. Note that no retrying or queueing is enforced at this layer. | 30 // messages. Note that no retrying or queueing is enforced at this layer. |
| 34 // Once a connection error is encountered, the ConnectionHandler will disconnect | 31 // Once a connection error is encountered, the ConnectionHandler will disconnect |
| 35 // the socket and must be reinitialized with a new StreamSocket before | 32 // the socket and must be reinitialized with a new StreamSocket before |
| 36 // messages can be sent/received again. | 33 // messages can be sent/received again. |
| 37 class GCM_EXPORT ConnectionHandler { | 34 class GCM_EXPORT ConnectionHandler { |
| 38 public: | 35 public: |
| 39 typedef base::Callback<void(std::unique_ptr<google::protobuf::MessageLite>)> | 36 typedef base::Callback<void(std::unique_ptr<google::protobuf::MessageLite>)> |
| 40 ProtoReceivedCallback; | 37 ProtoReceivedCallback; |
| 41 typedef base::Closure ProtoSentCallback; | 38 typedef base::Closure ProtoSentCallback; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 // in flight. | 57 // in flight. |
| 61 virtual bool CanSendMessage() const = 0; | 58 virtual bool CanSendMessage() const = 0; |
| 62 | 59 |
| 63 // Send an MCS protobuf message. CanSendMessage() must be true. | 60 // Send an MCS protobuf message. CanSendMessage() must be true. |
| 64 virtual void SendMessage(const google::protobuf::MessageLite& message) = 0; | 61 virtual void SendMessage(const google::protobuf::MessageLite& message) = 0; |
| 65 }; | 62 }; |
| 66 | 63 |
| 67 } // namespace gcm | 64 } // namespace gcm |
| 68 | 65 |
| 69 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ | 66 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_HANDLER_H_ |
| OLD | NEW |