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 26 matching lines...) Expand all Loading... |
37 } // namespace mcs_proto | 37 } // namespace mcs_proto |
38 | 38 |
39 namespace net { | 39 namespace net { |
40 class HttpNetworkSession; | 40 class HttpNetworkSession; |
41 } // namespace net | 41 } // namespace net |
42 | 42 |
43 namespace gcm { | 43 namespace gcm { |
44 | 44 |
45 class CheckinRequest; | 45 class CheckinRequest; |
46 class ConnectionFactory; | 46 class ConnectionFactory; |
| 47 class Encryptor; |
47 class GCMClientImplTest; | 48 class GCMClientImplTest; |
48 class GServicesSettings; | 49 class GServicesSettings; |
49 | 50 |
50 // Helper class for building GCM internals. Allows tests to inject fake versions | 51 // Helper class for building GCM internals. Allows tests to inject fake versions |
51 // as necessary. | 52 // as necessary. |
52 class GCM_EXPORT GCMInternalsBuilder { | 53 class GCM_EXPORT GCMInternalsBuilder { |
53 public: | 54 public: |
54 GCMInternalsBuilder(); | 55 GCMInternalsBuilder(); |
55 virtual ~GCMInternalsBuilder(); | 56 virtual ~GCMInternalsBuilder(); |
56 | 57 |
(...skipping 11 matching lines...) Expand all Loading... |
68 net::NetLog* net_log, | 69 net::NetLog* net_log, |
69 GCMStatsRecorder* recorder); | 70 GCMStatsRecorder* recorder); |
70 }; | 71 }; |
71 | 72 |
72 // Implements the GCM Client. It is used to coordinate MCS Client (communication | 73 // Implements the GCM Client. It is used to coordinate MCS Client (communication |
73 // with MCS) and other pieces of GCM infrastructure like Registration and | 74 // with MCS) and other pieces of GCM infrastructure like Registration and |
74 // Checkins. It also allows for registering user delegates that host | 75 // Checkins. It also allows for registering user delegates that host |
75 // applications that send and receive messages. | 76 // applications that send and receive messages. |
76 class GCM_EXPORT GCMClientImpl : public GCMClient { | 77 class GCM_EXPORT GCMClientImpl : public GCMClient { |
77 public: | 78 public: |
78 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); | 79 GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder, |
| 80 scoped_ptr<Encryptor> encryptor); |
79 virtual ~GCMClientImpl(); | 81 virtual ~GCMClientImpl(); |
80 | 82 |
81 // Overridden from GCMClient: | 83 // Overridden from GCMClient: |
82 virtual void Initialize( | 84 virtual void Initialize( |
83 const checkin_proto::ChromeBuildProto& chrome_build_proto, | 85 const checkin_proto::ChromeBuildProto& chrome_build_proto, |
84 const base::FilePath& store_path, | 86 const base::FilePath& store_path, |
85 const std::vector<std::string>& account_ids, | 87 const std::vector<std::string>& account_ids, |
86 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 88 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
87 const scoped_refptr<net::URLRequestContextGetter>& | 89 const scoped_refptr<net::URLRequestContextGetter>& |
88 url_request_context_getter, | 90 url_request_context_getter, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 220 |
219 // Fires OnMessageSendError event on the delegate of this calss, based on the | 221 // Fires OnMessageSendError event on the delegate of this calss, based on the |
220 // details in |data_message_stanza| and |message_data|. | 222 // details in |data_message_stanza| and |message_data|. |
221 void HandleIncomingSendError( | 223 void HandleIncomingSendError( |
222 const mcs_proto::DataMessageStanza& data_message_stanza, | 224 const mcs_proto::DataMessageStanza& data_message_stanza, |
223 MessageData& message_data); | 225 MessageData& message_data); |
224 | 226 |
225 // Builder for the GCM internals (mcs client, etc.). | 227 // Builder for the GCM internals (mcs client, etc.). |
226 scoped_ptr<GCMInternalsBuilder> internals_builder_; | 228 scoped_ptr<GCMInternalsBuilder> internals_builder_; |
227 | 229 |
| 230 // For encryption purpose. |
| 231 scoped_ptr<Encryptor> encryptor_; |
| 232 |
228 // Recorder that logs GCM activities. | 233 // Recorder that logs GCM activities. |
229 GCMStatsRecorder recorder_; | 234 GCMStatsRecorder recorder_; |
230 | 235 |
231 // State of the GCM Client Implementation. | 236 // State of the GCM Client Implementation. |
232 State state_; | 237 State state_; |
233 | 238 |
234 Delegate* delegate_; | 239 Delegate* delegate_; |
235 | 240 |
236 // Device checkin info (android ID and security token used by device). | 241 // Device checkin info (android ID and security token used by device). |
237 CheckinInfo device_checkin_info_; | 242 CheckinInfo device_checkin_info_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 290 |
286 // Factory for creating references in callbacks. | 291 // Factory for creating references in callbacks. |
287 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 292 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
288 | 293 |
289 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 294 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
290 }; | 295 }; |
291 | 296 |
292 } // namespace gcm | 297 } // namespace gcm |
293 | 298 |
294 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 299 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
OLD | NEW |