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 CheckOut() OVERRIDE; | 58 virtual void CheckOut() OVERRIDE; |
59 virtual void Register(const std::string& app_id, | 59 virtual void Register(const std::string& app_id, |
60 const std::string& cert, | 60 const std::string& cert, |
61 const std::vector<std::string>& sender_ids) OVERRIDE; | 61 const std::vector<std::string>& sender_ids) OVERRIDE; |
62 virtual void Unregister(const std::string& app_id) OVERRIDE; | 62 virtual void Unregister(const std::string& app_id) OVERRIDE; |
63 virtual void Send(const std::string& app_id, | 63 virtual void Send(const std::string& app_id, |
64 const std::string& receiver_id, | 64 const std::string& receiver_id, |
65 const OutgoingMessage& message) OVERRIDE; | 65 const OutgoingMessage& message) OVERRIDE; |
66 virtual bool IsReady() const OVERRIDE; | 66 virtual bool IsReady() const OVERRIDE; |
| 67 virtual void GetStatistics(GCMStatistics* stats) const OVERRIDE; |
67 | 68 |
68 private: | 69 private: |
69 // State representation of the GCMClient. | 70 // State representation of the GCMClient. |
70 enum State { | 71 enum State { |
71 // Uninitialized. | 72 // Uninitialized. |
72 UNINITIALIZED, | 73 UNINITIALIZED, |
73 // GCM store loading is in progress. | 74 // GCM store loading is in progress. |
74 LOADING, | 75 LOADING, |
75 // Initial device checkin is in progress. | 76 // Initial device checkin is in progress. |
76 INITIAL_DEVICE_CHECKIN, | 77 INITIAL_DEVICE_CHECKIN, |
77 // Ready to accept requests. | 78 // Ready to accept requests. |
78 READY, | 79 READY, |
79 }; | 80 }; |
80 | 81 |
| 82 std::string GetStateString(gcm::GCMClientImpl::State state) const; |
| 83 |
81 // The check-in info for the user. Returned by the server. | 84 // The check-in info for the user. Returned by the server. |
82 struct GCM_EXPORT CheckinInfo { | 85 struct GCM_EXPORT CheckinInfo { |
83 CheckinInfo() : android_id(0), secret(0) {} | 86 CheckinInfo() : android_id(0), secret(0) {} |
84 bool IsValid() const { return android_id != 0 && secret != 0; } | 87 bool IsValid() const { return android_id != 0 && secret != 0; } |
85 void Reset() { | 88 void Reset() { |
86 android_id = 0; | 89 android_id = 0; |
87 secret = 0; | 90 secret = 0; |
88 } | 91 } |
89 | 92 |
90 uint64 android_id; | 93 uint64 android_id; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 213 |
211 // Factory for creating references in callbacks. | 214 // Factory for creating references in callbacks. |
212 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 215 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
213 | 216 |
214 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 217 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
215 }; | 218 }; |
216 | 219 |
217 } // namespace gcm | 220 } // namespace gcm |
218 | 221 |
219 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 222 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
OLD | NEW |