Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 namespace net { | 45 namespace net { |
| 46 class HttpNetworkSession; | 46 class HttpNetworkSession; |
| 47 } // namespace net | 47 } // namespace net |
| 48 | 48 |
| 49 namespace gcm { | 49 namespace gcm { |
| 50 | 50 |
| 51 class CheckinRequest; | 51 class CheckinRequest; |
| 52 class ConnectionFactory; | 52 class ConnectionFactory; |
| 53 class GCMClientImplTest; | 53 class GCMClientImplTest; |
| 54 enum class GCMMessageStatus; | |
| 54 | 55 |
| 55 // Helper class for building GCM internals. Allows tests to inject fake versions | 56 // Helper class for building GCM internals. Allows tests to inject fake versions |
| 56 // as necessary. | 57 // as necessary. |
| 57 class GCMInternalsBuilder { | 58 class GCMInternalsBuilder { |
| 58 public: | 59 public: |
| 59 GCMInternalsBuilder(); | 60 GCMInternalsBuilder(); |
| 60 virtual ~GCMInternalsBuilder(); | 61 virtual ~GCMInternalsBuilder(); |
| 61 | 62 |
| 62 virtual std::unique_ptr<base::Clock> BuildClock(); | 63 virtual std::unique_ptr<base::Clock> BuildClock(); |
| 63 virtual std::unique_ptr<MCSClient> BuildMCSClient( | 64 virtual std::unique_ptr<MCSClient> BuildMCSClient( |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 146 |
| 146 // GCMStatsRecorder::Delegate implemenation. | 147 // GCMStatsRecorder::Delegate implemenation. |
| 147 void OnActivityRecorded() override; | 148 void OnActivityRecorded() override; |
| 148 | 149 |
| 149 // ConnectionFactory::ConnectionListener implementation. | 150 // ConnectionFactory::ConnectionListener implementation. |
| 150 void OnConnected(const GURL& current_server, | 151 void OnConnected(const GURL& current_server, |
| 151 const net::IPEndPoint& ip_endpoint) override; | 152 const net::IPEndPoint& ip_endpoint) override; |
| 152 void OnDisconnected() override; | 153 void OnDisconnected() override; |
| 153 | 154 |
| 154 private: | 155 private: |
| 156 // Send a message to GCM with information about the final status of a | |
| 157 // previously received message. This can be run as a result of a callback | |
| 158 // being executed from an AppHandler. | |
| 159 void SendMessageReceipt(const std::string& message_id, | |
| 160 const std::string& app_id, | |
| 161 GCMMessageStatus status); | |
|
Peter Beverloo
2017/02/13 13:47:07
nit: types before methods - there's an appropriate
harkness
2017/02/14 19:22:29
Done.
| |
| 162 | |
| 155 // The check-in info for the device. | 163 // The check-in info for the device. |
| 156 // TODO(fgorski): Convert to a class with explicit getters/setters. | 164 // TODO(fgorski): Convert to a class with explicit getters/setters. |
| 157 struct CheckinInfo { | 165 struct CheckinInfo { |
| 158 CheckinInfo(); | 166 CheckinInfo(); |
| 159 ~CheckinInfo(); | 167 ~CheckinInfo(); |
| 160 bool IsValid() const { return android_id != 0 && secret != 0; } | 168 bool IsValid() const { return android_id != 0 && secret != 0; } |
| 161 void SnapshotCheckinAccounts(); | 169 void SnapshotCheckinAccounts(); |
| 162 void Reset(); | 170 void Reset(); |
| 163 | 171 |
| 164 // Android ID of the device as assigned by the server. | 172 // Android ID of the device as assigned by the server. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 409 |
| 402 // Factory for creating references in callbacks. | 410 // Factory for creating references in callbacks. |
| 403 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 411 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 404 | 412 |
| 405 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 413 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 406 }; | 414 }; |
| 407 | 415 |
| 408 } // namespace gcm | 416 } // namespace gcm |
| 409 | 417 |
| 410 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 418 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
| OLD | NEW |