| 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_driver.h" | 5 #include "components/gcm_driver/gcm_driver.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "components/gcm_driver/gcm_app_handler.h" | 15 #include "components/gcm_driver/gcm_app_handler.h" |
| 16 | 16 |
| 17 namespace gcm { | 17 namespace gcm { |
| 18 | 18 |
| 19 namespace { | |
| 20 | |
| 21 const size_t kMaxSenders = 100; | |
| 22 | |
| 23 } // namespace | |
| 24 | |
| 25 InstanceIDHandler::InstanceIDHandler() { | 19 InstanceIDHandler::InstanceIDHandler() { |
| 26 } | 20 } |
| 27 | 21 |
| 28 InstanceIDHandler::~InstanceIDHandler() { | 22 InstanceIDHandler::~InstanceIDHandler() { |
| 29 } | 23 } |
| 30 | 24 |
| 31 void InstanceIDHandler::DeleteAllTokensForApp( | 25 void InstanceIDHandler::DeleteAllTokensForApp( |
| 32 const std::string& app_id, const DeleteTokenCallback& callback) { | 26 const std::string& app_id, const DeleteTokenCallback& callback) { |
| 33 DeleteToken(app_id, "*", "*", callback); | 27 DeleteToken(app_id, "*", "*", callback); |
| 34 } | 28 } |
| 35 | 29 |
| 30 const size_t GCMDriver::kMaxSenders = 100; |
| 31 |
| 36 GCMDriver::GCMDriver( | 32 GCMDriver::GCMDriver( |
| 37 const base::FilePath& store_path, | 33 const base::FilePath& store_path, |
| 38 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) | 34 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) |
| 39 : weak_ptr_factory_(this) { | 35 : weak_ptr_factory_(this) { |
| 40 // The |blocking_task_runner| can be NULL for tests that do not need the | 36 // The |blocking_task_runner| can be NULL for tests that do not need the |
| 41 // encryption capabilities of the GCMDriver class. | 37 // encryption capabilities of the GCMDriver class. |
| 42 if (blocking_task_runner) | 38 if (blocking_task_runner) |
| 43 encryption_provider_.Init(store_path, blocking_task_runner); | 39 encryption_provider_.Init(store_path, blocking_task_runner); |
| 44 } | 40 } |
| 45 | 41 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 GCMClient::Result result) { | 312 GCMClient::Result result) { |
| 317 // Invoke the original unregister callback. | 313 // Invoke the original unregister callback. |
| 318 unregister_callback.Run(result); | 314 unregister_callback.Run(result); |
| 319 | 315 |
| 320 // Trigger the pending registration. | 316 // Trigger the pending registration. |
| 321 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); | 317 DCHECK(register_callbacks_.find(app_id) != register_callbacks_.end()); |
| 322 RegisterImpl(app_id, normalized_sender_ids); | 318 RegisterImpl(app_id, normalized_sender_ids); |
| 323 } | 319 } |
| 324 | 320 |
| 325 } // namespace gcm | 321 } // namespace gcm |
| OLD | NEW |