| 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_MCS_CLIENT_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // Sends a message, with or without reliable message queueing (RMQ) support. | 115 // Sends a message, with or without reliable message queueing (RMQ) support. |
| 116 // Will asynchronously invoke the OnMessageSent callback regardless. | 116 // Will asynchronously invoke the OnMessageSent callback regardless. |
| 117 // Whether to use RMQ depends on whether the protobuf has |ttl| set or not. | 117 // Whether to use RMQ depends on whether the protobuf has |ttl| set or not. |
| 118 // |ttl == 0| denotes the message should only be sent if the connection is | 118 // |ttl == 0| denotes the message should only be sent if the connection is |
| 119 // open. |ttl > 0| will keep the message saved for |ttl| seconds, after which | 119 // open. |ttl > 0| will keep the message saved for |ttl| seconds, after which |
| 120 // it will be dropped if it was unable to be sent. When a message is dropped, | 120 // it will be dropped if it was unable to be sent. When a message is dropped, |
| 121 // |message_sent_callback_| is invoked with a TTL expiration error. | 121 // |message_sent_callback_| is invoked with a TTL expiration error. |
| 122 virtual void SendMessage(const MCSMessage& message); | 122 virtual void SendMessage(const MCSMessage& message); |
| 123 | 123 |
| 124 // Disconnects the client and permanently destroys the persistent GCM store. | |
| 125 // WARNING: This is permanent, and the client must be recreated with new | |
| 126 // credentials afterwards. | |
| 127 // TODO(jianli): destroying the persistent GCM store should be moved to | |
| 128 // GCMClient. | |
| 129 void Destroy(); | |
| 130 | |
| 131 // Returns the current state of the client. | 124 // Returns the current state of the client. |
| 132 State state() const { return state_; } | 125 State state() const { return state_; } |
| 133 | 126 |
| 134 protected: | 127 protected: |
| 135 // Sets a |gcm_store| for testing. Does not take ownership. | 128 // Sets a |gcm_store| for testing. Does not take ownership. |
| 136 // TODO(fgorski): Remove this method. Create GCMEngineFactory that will create | 129 // TODO(fgorski): Remove this method. Create GCMEngineFactory that will create |
| 137 // components of the engine. | 130 // components of the engine. |
| 138 void SetGCMStoreForTesting(GCMStore* gcm_store); | 131 void SetGCMStoreForTesting(GCMStore* gcm_store); |
| 139 | 132 |
| 140 private: | 133 private: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 HeartbeatManager heartbeat_manager_; | 257 HeartbeatManager heartbeat_manager_; |
| 265 | 258 |
| 266 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; | 259 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; |
| 267 | 260 |
| 268 DISALLOW_COPY_AND_ASSIGN(MCSClient); | 261 DISALLOW_COPY_AND_ASSIGN(MCSClient); |
| 269 }; | 262 }; |
| 270 | 263 |
| 271 } // namespace gcm | 264 } // namespace gcm |
| 272 | 265 |
| 273 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ | 266 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ |
| OLD | NEW |