| 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_GCM_CLIENT_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Delegate* delegate) OVERRIDE; | 57 Delegate* delegate) OVERRIDE; |
| 58 virtual void Load() OVERRIDE; | 58 virtual void Load() OVERRIDE; |
| 59 virtual void CheckOut() OVERRIDE; | 59 virtual void CheckOut() OVERRIDE; |
| 60 virtual void Register(const std::string& app_id, | 60 virtual void Register(const std::string& app_id, |
| 61 const std::string& cert, | 61 const std::string& cert, |
| 62 const std::vector<std::string>& sender_ids) OVERRIDE; | 62 const std::vector<std::string>& sender_ids) OVERRIDE; |
| 63 virtual void Unregister(const std::string& app_id) OVERRIDE; | 63 virtual void Unregister(const std::string& app_id) OVERRIDE; |
| 64 virtual void Send(const std::string& app_id, | 64 virtual void Send(const std::string& app_id, |
| 65 const std::string& receiver_id, | 65 const std::string& receiver_id, |
| 66 const OutgoingMessage& message) OVERRIDE; | 66 const OutgoingMessage& message) OVERRIDE; |
| 67 virtual GCMStatistics GetStatistics() const OVERRIDE; |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 // State representation of the GCMClient. | 70 // State representation of the GCMClient. |
| 71 // Any change made to this enum should have corresponding change in the |
| 72 // GetStateString(...) function. |
| 70 enum State { | 73 enum State { |
| 71 // Uninitialized. | 74 // Uninitialized. |
| 72 UNINITIALIZED, | 75 UNINITIALIZED, |
| 73 // Initialized, | 76 // Initialized, |
| 74 INITIALIZED, | 77 INITIALIZED, |
| 75 // GCM store loading is in progress. | 78 // GCM store loading is in progress. |
| 76 LOADING, | 79 LOADING, |
| 77 // Initial device checkin is in progress. | 80 // Initial device checkin is in progress. |
| 78 INITIAL_DEVICE_CHECKIN, | 81 INITIAL_DEVICE_CHECKIN, |
| 79 // Ready to accept requests. | 82 // Ready to accept requests. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 PendingRegistrations; | 103 PendingRegistrations; |
| 101 | 104 |
| 102 // Collection of pending unregistration requests. Keys are app IDs, while | 105 // Collection of pending unregistration requests. Keys are app IDs, while |
| 103 // values are pending unregistration requests to disable the registration ID | 106 // values are pending unregistration requests to disable the registration ID |
| 104 // currently assigned to the application. | 107 // currently assigned to the application. |
| 105 typedef std::map<std::string, UnregistrationRequest*> | 108 typedef std::map<std::string, UnregistrationRequest*> |
| 106 PendingUnregistrations; | 109 PendingUnregistrations; |
| 107 | 110 |
| 108 friend class GCMClientImplTest; | 111 friend class GCMClientImplTest; |
| 109 | 112 |
| 113 // Returns text representation of the enum State. |
| 114 std::string GetStateString() const; |
| 115 |
| 110 // Callbacks for the MCSClient. | 116 // Callbacks for the MCSClient. |
| 111 // Receives messages and dispatches them to relevant user delegates. | 117 // Receives messages and dispatches them to relevant user delegates. |
| 112 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message); | 118 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message); |
| 113 // Receives confirmation of sent messages or information about errors. | 119 // Receives confirmation of sent messages or information about errors. |
| 114 void OnMessageSentToMCS(int64 user_serial_number, | 120 void OnMessageSentToMCS(int64 user_serial_number, |
| 115 const std::string& app_id, | 121 const std::string& app_id, |
| 116 const std::string& message_id, | 122 const std::string& message_id, |
| 117 MCSClient::MessageSendStatus status); | 123 MCSClient::MessageSendStatus status); |
| 118 // Receives information about mcs_client_ errors. | 124 // Receives information about mcs_client_ errors. |
| 119 void OnMCSError(); | 125 void OnMCSError(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 221 |
| 216 // Factory for creating references in callbacks. | 222 // Factory for creating references in callbacks. |
| 217 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 223 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 218 | 224 |
| 219 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 225 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 220 }; | 226 }; |
| 221 | 227 |
| 222 } // namespace gcm | 228 } // namespace gcm |
| 223 | 229 |
| 224 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 230 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| OLD | NEW |