| 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/fake_gcm_client.h" | 5 #include "components/gcm_driver/fake_gcm_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void FakeGCMClient::Initialize( | 75 void FakeGCMClient::Initialize( |
| 76 const ChromeBuildInfo& chrome_build_info, | 76 const ChromeBuildInfo& chrome_build_info, |
| 77 const base::FilePath& store_path, | 77 const base::FilePath& store_path, |
| 78 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 78 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| 79 const scoped_refptr<net::URLRequestContextGetter>& | 79 const scoped_refptr<net::URLRequestContextGetter>& |
| 80 url_request_context_getter, | 80 url_request_context_getter, |
| 81 std::unique_ptr<Encryptor> encryptor, | 81 std::unique_ptr<Encryptor> encryptor, |
| 82 Delegate* delegate) { | 82 Delegate* delegate) { |
| 83 category_for_subtypes_ = chrome_build_info.category_for_subtypes; |
| 83 delegate_ = delegate; | 84 delegate_ = delegate; |
| 84 } | 85 } |
| 85 | 86 |
| 86 void FakeGCMClient::Start(StartMode start_mode) { | 87 void FakeGCMClient::Start(StartMode start_mode) { |
| 87 DCHECK(io_thread_->RunsTasksOnCurrentThread()); | 88 DCHECK(io_thread_->RunsTasksOnCurrentThread()); |
| 88 | 89 |
| 89 if (started_) | 90 if (started_) |
| 90 return; | 91 return; |
| 91 | 92 |
| 92 if (start_mode == IMMEDIATE_START) | 93 if (start_mode == IMMEDIATE_START) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (iter == instance_id_data_.end()) { | 214 if (iter == instance_id_data_.end()) { |
| 214 instance_id->clear(); | 215 instance_id->clear(); |
| 215 extra_data->clear(); | 216 extra_data->clear(); |
| 216 return; | 217 return; |
| 217 } | 218 } |
| 218 | 219 |
| 219 *instance_id = iter->second.first; | 220 *instance_id = iter->second.first; |
| 220 *extra_data = iter->second.second; | 221 *extra_data = iter->second.second; |
| 221 } | 222 } |
| 222 | 223 |
| 224 bool FakeGCMClient::CategoryHasSubtype(const std::string& category) { |
| 225 return category == category_for_subtypes_; |
| 226 } |
| 227 |
| 223 void FakeGCMClient::AddHeartbeatInterval(const std::string& scope, | 228 void FakeGCMClient::AddHeartbeatInterval(const std::string& scope, |
| 224 int interval_ms) { | 229 int interval_ms) { |
| 225 } | 230 } |
| 226 | 231 |
| 227 void FakeGCMClient::RemoveHeartbeatInterval(const std::string& scope) { | 232 void FakeGCMClient::RemoveHeartbeatInterval(const std::string& scope) { |
| 228 } | 233 } |
| 229 | 234 |
| 230 void FakeGCMClient::PerformDelayedStart() { | 235 void FakeGCMClient::PerformDelayedStart() { |
| 231 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 236 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
| 232 | 237 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 delegate_->OnMessageSendError(app_id, send_error_details); | 323 delegate_->OnMessageSendError(app_id, send_error_details); |
| 319 } | 324 } |
| 320 | 325 |
| 321 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, | 326 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, |
| 322 const std::string& message_id) { | 327 const std::string& message_id) { |
| 323 if (delegate_) | 328 if (delegate_) |
| 324 delegate_->OnSendAcknowledged(app_id, message_id); | 329 delegate_->OnSendAcknowledged(app_id, message_id); |
| 325 } | 330 } |
| 326 | 331 |
| 327 } // namespace gcm | 332 } // namespace gcm |
| OLD | NEW |