| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/instance_id/instance_id_driver.h" | 5 #include "components/gcm_driver/instance_id/instance_id_driver.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "components/gcm_driver/gcm_driver.h" | 10 #include "components/gcm_driver/gcm_driver.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 InstanceIDDriver::~InstanceIDDriver() { | 32 InstanceIDDriver::~InstanceIDDriver() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { | 35 InstanceID* InstanceIDDriver::GetInstanceID(const std::string& app_id) { |
| 36 auto iter = instance_id_map_.find(app_id); | 36 auto iter = instance_id_map_.find(app_id); |
| 37 if (iter != instance_id_map_.end()) | 37 if (iter != instance_id_map_.end()) |
| 38 return iter->second.get(); | 38 return iter->second.get(); |
| 39 | 39 |
| 40 std::unique_ptr<InstanceID> instance_id = | 40 std::unique_ptr<InstanceID> instance_id = |
| 41 InstanceID::Create(app_id, gcm_driver_); | 41 InstanceID::CreateInternal(app_id, gcm_driver_); |
| 42 InstanceID* instance_id_ptr = instance_id.get(); | 42 InstanceID* instance_id_ptr = instance_id.get(); |
| 43 instance_id_map_.insert(std::make_pair(app_id, std::move(instance_id))); | 43 instance_id_map_.insert(std::make_pair(app_id, std::move(instance_id))); |
| 44 return instance_id_ptr; | 44 return instance_id_ptr; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { | 47 void InstanceIDDriver::RemoveInstanceID(const std::string& app_id) { |
| 48 instance_id_map_.erase(app_id); | 48 instance_id_map_.erase(app_id); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { | 51 bool InstanceIDDriver::ExistsInstanceID(const std::string& app_id) const { |
| 52 return instance_id_map_.find(app_id) != instance_id_map_.end(); | 52 return instance_id_map_.find(app_id) != instance_id_map_.end(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace instance_id | 55 } // namespace instance_id |
| OLD | NEW |