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