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 27 matching lines...) Expand all Loading... |
38 } // namespace mcs_proto | 38 } // namespace mcs_proto |
39 | 39 |
40 namespace net { | 40 namespace net { |
41 class HttpNetworkSession; | 41 class HttpNetworkSession; |
42 } // namespace net | 42 } // namespace net |
43 | 43 |
44 namespace gcm { | 44 namespace gcm { |
45 | 45 |
46 class CheckinRequest; | 46 class CheckinRequest; |
47 class ConnectionFactory; | 47 class ConnectionFactory; |
| 48 class Encryptor; |
48 class GCMClientImplTest; | 49 class GCMClientImplTest; |
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 |
57 virtual scoped_ptr<base::Clock> BuildClock(); | 58 virtual scoped_ptr<base::Clock> BuildClock(); |
(...skipping 10 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 224 |
223 // Fires OnMessageSendError event on the delegate of this calss, based on the | 225 // Fires OnMessageSendError event on the delegate of this calss, based on the |
224 // details in |data_message_stanza| and |message_data|. | 226 // details in |data_message_stanza| and |message_data|. |
225 void HandleIncomingSendError( | 227 void HandleIncomingSendError( |
226 const mcs_proto::DataMessageStanza& data_message_stanza, | 228 const mcs_proto::DataMessageStanza& data_message_stanza, |
227 MessageData& message_data); | 229 MessageData& message_data); |
228 | 230 |
229 // Builder for the GCM internals (mcs client, etc.). | 231 // Builder for the GCM internals (mcs client, etc.). |
230 scoped_ptr<GCMInternalsBuilder> internals_builder_; | 232 scoped_ptr<GCMInternalsBuilder> internals_builder_; |
231 | 233 |
| 234 // For encryption purpose. |
| 235 scoped_ptr<Encryptor> encryptor_; |
| 236 |
232 // Recorder that logs GCM activities. | 237 // Recorder that logs GCM activities. |
233 GCMStatsRecorder recorder_; | 238 GCMStatsRecorder recorder_; |
234 | 239 |
235 // State of the GCM Client Implementation. | 240 // State of the GCM Client Implementation. |
236 State state_; | 241 State state_; |
237 | 242 |
238 Delegate* delegate_; | 243 Delegate* delegate_; |
239 | 244 |
240 // Device checkin info (android ID and security token used by device). | 245 // Device checkin info (android ID and security token used by device). |
241 CheckinInfo device_checkin_info_; | 246 CheckinInfo device_checkin_info_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 294 |
290 // Factory for creating references in callbacks. | 295 // Factory for creating references in callbacks. |
291 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 296 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
292 | 297 |
293 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 298 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
294 }; | 299 }; |
295 | 300 |
296 } // namespace gcm | 301 } // namespace gcm |
297 | 302 |
298 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 303 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
OLD | NEW |