| 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 #include "google_apis/gcm/gcm_client_impl.h" | 5 #include "google_apis/gcm/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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 GCMInternalsBuilder::GCMInternalsBuilder() {} | 121 GCMInternalsBuilder::GCMInternalsBuilder() {} |
| 122 GCMInternalsBuilder::~GCMInternalsBuilder() {} | 122 GCMInternalsBuilder::~GCMInternalsBuilder() {} |
| 123 | 123 |
| 124 scoped_ptr<base::Clock> GCMInternalsBuilder::BuildClock() { | 124 scoped_ptr<base::Clock> GCMInternalsBuilder::BuildClock() { |
| 125 return make_scoped_ptr<base::Clock>(new base::DefaultClock()); | 125 return make_scoped_ptr<base::Clock>(new base::DefaultClock()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 scoped_ptr<GCMStore> GCMInternalsBuilder::BuildGCMStore( | |
| 129 const base::FilePath& path, | |
| 130 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { | |
| 131 return make_scoped_ptr<GCMStore>( | |
| 132 new GCMStoreImpl(path, blocking_task_runner)); | |
| 133 } | |
| 134 | |
| 135 scoped_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient( | 128 scoped_ptr<MCSClient> GCMInternalsBuilder::BuildMCSClient( |
| 136 const std::string& version, | 129 const std::string& version, |
| 137 base::Clock* clock, | 130 base::Clock* clock, |
| 138 ConnectionFactory* connection_factory, | 131 ConnectionFactory* connection_factory, |
| 139 GCMStore* gcm_store) { | 132 GCMStore* gcm_store) { |
| 140 return make_scoped_ptr<MCSClient>( | 133 return make_scoped_ptr<MCSClient>( |
| 141 new MCSClient(version, | 134 new MCSClient(version, |
| 142 clock, | 135 clock, |
| 143 connection_factory, | 136 connection_factory, |
| 144 gcm_store)); | 137 gcm_store)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 url_request_context_getter_ = url_request_context_getter; | 178 url_request_context_getter_ = url_request_context_getter; |
| 186 const net::HttpNetworkSession::Params* network_session_params = | 179 const net::HttpNetworkSession::Params* network_session_params = |
| 187 url_request_context_getter_->GetURLRequestContext()-> | 180 url_request_context_getter_->GetURLRequestContext()-> |
| 188 GetNetworkSessionParams(); | 181 GetNetworkSessionParams(); |
| 189 DCHECK(network_session_params); | 182 DCHECK(network_session_params); |
| 190 network_session_ = new net::HttpNetworkSession(*network_session_params); | 183 network_session_ = new net::HttpNetworkSession(*network_session_params); |
| 191 | 184 |
| 192 chrome_build_proto_.CopyFrom(chrome_build_proto); | 185 chrome_build_proto_.CopyFrom(chrome_build_proto); |
| 193 account_ids_ = account_ids; | 186 account_ids_ = account_ids; |
| 194 | 187 |
| 195 gcm_store_ = | 188 gcm_store_.reset(new GCMStoreImpl(false, path, blocking_task_runner)); |
| 196 internals_builder_->BuildGCMStore(path, blocking_task_runner).Pass(); | |
| 197 | 189 |
| 198 delegate_ = delegate; | 190 delegate_ = delegate; |
| 199 | 191 |
| 200 state_ = INITIALIZED; | 192 state_ = INITIALIZED; |
| 201 } | 193 } |
| 202 | 194 |
| 203 void GCMClientImpl::Load() { | 195 void GCMClientImpl::Load() { |
| 204 DCHECK_EQ(INITIALIZED, state_); | 196 DCHECK_EQ(INITIALIZED, state_); |
| 205 | 197 |
| 206 // Once the loading is completed, the check-in will be initiated. | 198 // Once the loading is completed, the check-in will be initiated. |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 if (iter != send_error_details.additional_data.end()) { | 688 if (iter != send_error_details.additional_data.end()) { |
| 697 send_error_details.message_id = iter->second; | 689 send_error_details.message_id = iter->second; |
| 698 send_error_details.additional_data.erase(iter); | 690 send_error_details.additional_data.erase(iter); |
| 699 } | 691 } |
| 700 | 692 |
| 701 delegate_->OnMessageSendError(data_message_stanza.category(), | 693 delegate_->OnMessageSendError(data_message_stanza.category(), |
| 702 send_error_details); | 694 send_error_details); |
| 703 } | 695 } |
| 704 | 696 |
| 705 } // namespace gcm | 697 } // namespace gcm |
| OLD | NEW |