Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Side by Side Diff: components/gcm_driver/gcm_client_impl.h

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Added a callback entry point to GCMDriver, moved MessageReceiptCallback to gcm_message_status. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 virtual void SendMessageReceipt(const std::string& message_id,
Peter Beverloo 2017/02/08 17:09:09 This shouldn't be declared as `virtual` - nothing
harkness 2017/02/09 16:27:30 Done.
160 const std::string& app_id,
161 GCMMessageStatus status);
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698