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