| 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_impl.h" | 5 #include "components/gcm_driver/instance_id/instance_id_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 void InstanceIDImpl::OnDeleteTokenCompleted( | 207 void InstanceIDImpl::OnDeleteTokenCompleted( |
| 208 const DeleteTokenCallback& callback, | 208 const DeleteTokenCallback& callback, |
| 209 gcm::GCMClient::Result result) { | 209 gcm::GCMClient::Result result) { |
| 210 callback.Run(GCMClientResultToInstanceIDResult(result)); | 210 callback.Run(GCMClientResultToInstanceIDResult(result)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void InstanceIDImpl::OnDeleteIDCompleted( | 213 void InstanceIDImpl::OnDeleteIDCompleted( |
| 214 const DeleteIDCallback& callback, | 214 const DeleteIDCallback& callback, |
| 215 gcm::GCMClient::Result result) { | 215 gcm::GCMClient::Result result) { |
| 216 callback.Run(GCMClientResultToInstanceIDResult(result)); | 216 callback.Run(GCMClientResultToInstanceIDResult(result)); |
| 217 // Now |this| may have been deleted. |
| 217 } | 218 } |
| 218 | 219 |
| 219 void InstanceIDImpl::GetInstanceIDDataCompleted( | 220 void InstanceIDImpl::GetInstanceIDDataCompleted( |
| 220 const std::string& instance_id, | 221 const std::string& instance_id, |
| 221 const std::string& extra_data) { | 222 const std::string& extra_data) { |
| 222 id_ = instance_id; | 223 id_ = instance_id; |
| 223 | 224 |
| 224 if (extra_data.empty()) { | 225 if (extra_data.empty()) { |
| 225 creation_time_ = base::Time(); | 226 creation_time_ = base::Time(); |
| 226 } else { | 227 } else { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 id_.erase(std::remove(id_.begin(), id_.end(), '='), id_.end()); | 264 id_.erase(std::remove(id_.begin(), id_.end(), '='), id_.end()); |
| 264 | 265 |
| 265 creation_time_ = base::Time::Now(); | 266 creation_time_ = base::Time::Now(); |
| 266 | 267 |
| 267 // Save to the persistent store. | 268 // Save to the persistent store. |
| 268 handler_->AddInstanceIDData( | 269 handler_->AddInstanceIDData( |
| 269 app_id(), id_, base::Int64ToString(creation_time_.ToInternalValue())); | 270 app_id(), id_, base::Int64ToString(creation_time_.ToInternalValue())); |
| 270 } | 271 } |
| 271 | 272 |
| 272 } // namespace instance_id | 273 } // namespace instance_id |
| OLD | NEW |