| 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> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "google_apis/gcm/base/mcs_message.h" | 16 #include "google_apis/gcm/base/mcs_message.h" |
| 17 #include "google_apis/gcm/engine/gcm_store.h" | 17 #include "google_apis/gcm/engine/gcm_store.h" |
| 18 #include "google_apis/gcm/engine/gservices_settings.h" | 18 #include "google_apis/gcm/engine/gservices_settings.h" |
| 19 #include "google_apis/gcm/engine/mcs_client.h" | 19 #include "google_apis/gcm/engine/mcs_client.h" |
| 20 #include "google_apis/gcm/engine/registration_request.h" | 20 #include "google_apis/gcm/engine/registration_request.h" |
| 21 #include "google_apis/gcm/engine/unregistration_request.h" | 21 #include "google_apis/gcm/engine/unregistration_request.h" |
| 22 #include "google_apis/gcm/gcm_client.h" | 22 #include "google_apis/gcm/gcm_client.h" |
| 23 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | 23 #include "google_apis/gcm/monitoring/gcm_stats_recorder_impl.h" |
| 24 #include "google_apis/gcm/protocol/android_checkin.pb.h" | 24 #include "google_apis/gcm/protocol/android_checkin.pb.h" |
| 25 #include "google_apis/gcm/protocol/checkin.pb.h" | 25 #include "google_apis/gcm/protocol/checkin.pb.h" |
| 26 #include "net/base/net_log.h" | 26 #include "net/base/net_log.h" |
| 27 #include "net/url_request/url_request_context_getter.h" | 27 #include "net/url_request/url_request_context_getter.h" |
| 28 | 28 |
| 29 class GURL; | 29 class GURL; |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class Clock; | 32 class Clock; |
| 33 class Time; | 33 class Time; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 scoped_refptr<net::HttpNetworkSession> network_session, | 67 scoped_refptr<net::HttpNetworkSession> network_session, |
| 68 net::NetLog* net_log, | 68 net::NetLog* net_log, |
| 69 GCMStatsRecorder* recorder); | 69 GCMStatsRecorder* recorder); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Implements the GCM Client. It is used to coordinate MCS Client (communication | 72 // Implements the GCM Client. It is used to coordinate MCS Client (communication |
| 73 // with MCS) and other pieces of GCM infrastructure like Registration and | 73 // with MCS) and other pieces of GCM infrastructure like Registration and |
| 74 // Checkins. It also allows for registering user delegates that host | 74 // Checkins. It also allows for registering user delegates that host |
| 75 // applications that send and receive messages. | 75 // applications that send and receive messages. |
| 76 class GCM_EXPORT GCMClientImpl | 76 class GCM_EXPORT GCMClientImpl |
| 77 : public GCMClient, public GCMStatsRecorder::Delegate { | 77 : public GCMClient, public GCMStatsRecorderImpl::Delegate { |
| 78 public: | 78 public: |
| 79 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); | 79 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); |
| 80 virtual ~GCMClientImpl(); | 80 virtual ~GCMClientImpl(); |
| 81 | 81 |
| 82 // Overridden from GCMClient: | 82 // Overridden from GCMClient: |
| 83 virtual void Initialize( | 83 virtual void Initialize( |
| 84 const ChromeBuildInfo& chrome_build_info, | 84 const ChromeBuildInfo& chrome_build_info, |
| 85 const base::FilePath& store_path, | 85 const base::FilePath& store_path, |
| 86 const std::vector<std::string>& account_ids, | 86 const std::vector<std::string>& account_ids, |
| 87 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 87 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Fires OnMessageSendError event on the delegate of this calss, based on the | 226 // Fires OnMessageSendError event on the delegate of this calss, based on the |
| 227 // details in |data_message_stanza| and |message_data|. | 227 // details in |data_message_stanza| and |message_data|. |
| 228 void HandleIncomingSendError( | 228 void HandleIncomingSendError( |
| 229 const mcs_proto::DataMessageStanza& data_message_stanza, | 229 const mcs_proto::DataMessageStanza& data_message_stanza, |
| 230 MessageData& message_data); | 230 MessageData& message_data); |
| 231 | 231 |
| 232 // Builder for the GCM internals (mcs client, etc.). | 232 // Builder for the GCM internals (mcs client, etc.). |
| 233 scoped_ptr<GCMInternalsBuilder> internals_builder_; | 233 scoped_ptr<GCMInternalsBuilder> internals_builder_; |
| 234 | 234 |
| 235 // Recorder that logs GCM activities. | 235 // Recorder that logs GCM activities. |
| 236 GCMStatsRecorder recorder_; | 236 GCMStatsRecorderImpl recorder_; |
| 237 | 237 |
| 238 // State of the GCM Client Implementation. | 238 // State of the GCM Client Implementation. |
| 239 State state_; | 239 State state_; |
| 240 | 240 |
| 241 GCMClient::Delegate* delegate_; | 241 GCMClient::Delegate* delegate_; |
| 242 | 242 |
| 243 // Device checkin info (android ID and security token used by device). | 243 // Device checkin info (android ID and security token used by device). |
| 244 CheckinInfo device_checkin_info_; | 244 CheckinInfo device_checkin_info_; |
| 245 | 245 |
| 246 // Clock used for timing of retry logic. Passed in for testing. Owned by | 246 // Clock used for timing of retry logic. Passed in for testing. Owned by |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 // Factory for creating references in callbacks. | 293 // Factory for creating references in callbacks. |
| 294 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 294 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 295 | 295 |
| 296 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 296 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 } // namespace gcm | 299 } // namespace gcm |
| 300 | 300 |
| 301 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 301 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| OLD | NEW |