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_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "components/gcm_driver/gcm_activity.h" | 14 #include "components/gcm_driver/gcm_activity.h" |
15 | 15 |
16 template <class T> class scoped_refptr; | 16 template <class T> class scoped_refptr; |
17 | 17 |
| 18 class GURL; |
| 19 |
18 namespace base { | 20 namespace base { |
19 class FilePath; | 21 class FilePath; |
20 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
21 } | 23 } |
22 | 24 |
23 namespace net { | 25 namespace net { |
| 26 class IPEndPoint; |
24 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
25 } | 28 } |
26 | 29 |
27 namespace gcm { | 30 namespace gcm { |
28 | 31 |
29 class Encryptor; | 32 class Encryptor; |
30 | 33 |
31 // Interface that encapsulates the network communications with the Google Cloud | 34 // Interface that encapsulates the network communications with the Google Cloud |
32 // Messaging server. This interface is not supposed to be thread-safe. | 35 // Messaging server. This interface is not supposed to be thread-safe. |
33 class GCMClient { | 36 class GCMClient { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 const SendErrorDetails& send_error_details) = 0; | 185 const SendErrorDetails& send_error_details) = 0; |
183 | 186 |
184 // Called when the GCM becomes ready. To get to this state, GCMClient | 187 // Called when the GCM becomes ready. To get to this state, GCMClient |
185 // finished loading from the GCM store and retrieved the device check-in | 188 // finished loading from the GCM store and retrieved the device check-in |
186 // from the server if it hadn't yet. | 189 // from the server if it hadn't yet. |
187 virtual void OnGCMReady() = 0; | 190 virtual void OnGCMReady() = 0; |
188 | 191 |
189 // Called when activities are being recorded and a new activity has just | 192 // Called when activities are being recorded and a new activity has just |
190 // been recorded. | 193 // been recorded. |
191 virtual void OnActivityRecorded() = 0; | 194 virtual void OnActivityRecorded() = 0; |
| 195 |
| 196 // Called when a new connection is established and a successful handshake |
| 197 // has been performed. |
| 198 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) = 0; |
| 199 |
| 200 // Called when the connection is interrupted. |
| 201 virtual void OnDisconnected() = 0; |
192 }; | 202 }; |
193 | 203 |
194 GCMClient(); | 204 GCMClient(); |
195 virtual ~GCMClient(); | 205 virtual ~GCMClient(); |
196 | 206 |
197 // Begins initialization of the GCM Client. This will not trigger a | 207 // Begins initialization of the GCM Client. This will not trigger a |
198 // connection. | 208 // connection. |
199 // |chrome_build_info|: chrome info, i.e., version, channel and etc. | 209 // |chrome_build_info|: chrome info, i.e., version, channel and etc. |
200 // |store_path|: path to the GCM store. | 210 // |store_path|: path to the GCM store. |
201 // |account_ids|: account IDs to be related to the device when checking in. | 211 // |account_ids|: account IDs to be related to the device when checking in. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // Clear all recorded GCM activity logs. | 265 // Clear all recorded GCM activity logs. |
256 virtual void ClearActivityLogs() = 0; | 266 virtual void ClearActivityLogs() = 0; |
257 | 267 |
258 // Gets internal states and statistics. | 268 // Gets internal states and statistics. |
259 virtual GCMStatistics GetStatistics() const = 0; | 269 virtual GCMStatistics GetStatistics() const = 0; |
260 }; | 270 }; |
261 | 271 |
262 } // namespace gcm | 272 } // namespace gcm |
263 | 273 |
264 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ | 274 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |
OLD | NEW |