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 #include "components/gcm_driver/gcm_client_impl.h" | 5 #include "components/gcm_driver/gcm_client_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 void GCMClientImpl::Initialize( | 294 void GCMClientImpl::Initialize( |
295 const ChromeBuildInfo& chrome_build_info, | 295 const ChromeBuildInfo& chrome_build_info, |
296 const base::FilePath& path, | 296 const base::FilePath& path, |
297 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 297 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
298 const scoped_refptr<net::URLRequestContextGetter>& | 298 const scoped_refptr<net::URLRequestContextGetter>& |
299 url_request_context_getter, | 299 url_request_context_getter, |
300 scoped_ptr<Encryptor> encryptor, | 300 scoped_ptr<Encryptor> encryptor, |
301 GCMClient::Delegate* delegate) { | 301 GCMClient::Delegate* delegate) { |
302 DCHECK_EQ(UNINITIALIZED, state_); | 302 DCHECK_EQ(UNINITIALIZED, state_); |
303 DCHECK(url_request_context_getter); | 303 DCHECK(url_request_context_getter.get()); |
304 DCHECK(delegate); | 304 DCHECK(delegate); |
305 | 305 |
306 url_request_context_getter_ = url_request_context_getter; | 306 url_request_context_getter_ = url_request_context_getter; |
307 const net::HttpNetworkSession::Params* network_session_params = | 307 const net::HttpNetworkSession::Params* network_session_params = |
308 url_request_context_getter_->GetURLRequestContext()-> | 308 url_request_context_getter_->GetURLRequestContext()-> |
309 GetNetworkSessionParams(); | 309 GetNetworkSessionParams(); |
310 DCHECK(network_session_params); | 310 DCHECK(network_session_params); |
311 network_session_ = new net::HttpNetworkSession(*network_session_params); | 311 network_session_ = new net::HttpNetworkSession(*network_session_params); |
312 | 312 |
313 chrome_build_info_ = chrome_build_info; | 313 chrome_build_info_ = chrome_build_info; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 device_checkin_info_.secret, | 494 device_checkin_info_.secret, |
495 device_checkin_info_.account_tokens, | 495 device_checkin_info_.account_tokens, |
496 gservices_settings_.digest(), | 496 gservices_settings_.digest(), |
497 chrome_build_proto); | 497 chrome_build_proto); |
498 checkin_request_.reset( | 498 checkin_request_.reset( |
499 new CheckinRequest(gservices_settings_.GetCheckinURL(), | 499 new CheckinRequest(gservices_settings_.GetCheckinURL(), |
500 request_info, | 500 request_info, |
501 kDefaultBackoffPolicy, | 501 kDefaultBackoffPolicy, |
502 base::Bind(&GCMClientImpl::OnCheckinCompleted, | 502 base::Bind(&GCMClientImpl::OnCheckinCompleted, |
503 weak_ptr_factory_.GetWeakPtr()), | 503 weak_ptr_factory_.GetWeakPtr()), |
504 url_request_context_getter_, | 504 url_request_context_getter_.get(), |
505 &recorder_)); | 505 &recorder_)); |
506 // Taking a snapshot of the accounts count here, as there might be an asynch | 506 // Taking a snapshot of the accounts count here, as there might be an asynch |
507 // update of the account tokens while checkin is in progress. | 507 // update of the account tokens while checkin is in progress. |
508 device_checkin_info_.SnapshotCheckinAccounts(); | 508 device_checkin_info_.SnapshotCheckinAccounts(); |
509 checkin_request_->Start(); | 509 checkin_request_->Start(); |
510 } | 510 } |
511 | 511 |
512 void GCMClientImpl::OnCheckinCompleted( | 512 void GCMClientImpl::OnCheckinCompleted( |
513 const checkin_proto::AndroidCheckinResponse& checkin_response) { | 513 const checkin_proto::AndroidCheckinResponse& checkin_response) { |
514 checkin_request_.reset(); | 514 checkin_request_.reset(); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 | 984 |
985 recorder_.RecordIncomingSendError( | 985 recorder_.RecordIncomingSendError( |
986 data_message_stanza.category(), | 986 data_message_stanza.category(), |
987 data_message_stanza.to(), | 987 data_message_stanza.to(), |
988 data_message_stanza.id()); | 988 data_message_stanza.id()); |
989 delegate_->OnMessageSendError(data_message_stanza.category(), | 989 delegate_->OnMessageSendError(data_message_stanza.category(), |
990 send_error_details); | 990 send_error_details); |
991 } | 991 } |
992 | 992 |
993 } // namespace gcm | 993 } // namespace gcm |
OLD | NEW |