| 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 "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // static | 49 // static |
| 50 scoped_ptr<InstanceID> InstanceID::Create(const std::string& app_id, | 50 scoped_ptr<InstanceID> InstanceID::Create(const std::string& app_id, |
| 51 gcm::GCMDriver* gcm_driver) { | 51 gcm::GCMDriver* gcm_driver) { |
| 52 return make_scoped_ptr(new InstanceIDImpl(app_id, gcm_driver)); | 52 return make_scoped_ptr(new InstanceIDImpl(app_id, gcm_driver)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 InstanceIDImpl::InstanceIDImpl(const std::string& app_id, | 55 InstanceIDImpl::InstanceIDImpl(const std::string& app_id, |
| 56 gcm::GCMDriver* gcm_driver) | 56 gcm::GCMDriver* gcm_driver) |
| 57 : InstanceID(app_id), | 57 : InstanceID(app_id), |
| 58 gcm_driver_(gcm_driver), | 58 gcm_driver_(gcm_driver), |
| 59 load_from_store_(false), | |
| 60 weak_ptr_factory_(this) { | 59 weak_ptr_factory_(this) { |
| 61 GetInstanceIDHandler()->GetInstanceIDData( | 60 GetInstanceIDHandler()->GetInstanceIDData( |
| 62 app_id, | 61 app_id, |
| 63 base::Bind(&InstanceIDImpl::GetInstanceIDDataCompleted, | 62 base::Bind(&InstanceIDImpl::GetInstanceIDDataCompleted, |
| 64 weak_ptr_factory_.GetWeakPtr())); | 63 weak_ptr_factory_.GetWeakPtr())); |
| 65 } | 64 } |
| 66 | 65 |
| 67 InstanceIDImpl::~InstanceIDImpl() { | 66 InstanceIDImpl::~InstanceIDImpl() { |
| 68 } | 67 } |
| 69 | 68 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 creation_time_ = base::Time::Now(); | 281 creation_time_ = base::Time::Now(); |
| 283 | 282 |
| 284 // Save to the persistent store. | 283 // Save to the persistent store. |
| 285 GetInstanceIDHandler()->AddInstanceIDData( | 284 GetInstanceIDHandler()->AddInstanceIDData( |
| 286 app_id(), | 285 app_id(), |
| 287 id_, | 286 id_, |
| 288 base::Int64ToString(creation_time_.ToInternalValue())); | 287 base::Int64ToString(creation_time_.ToInternalValue())); |
| 289 } | 288 } |
| 290 | 289 |
| 291 } // namespace instance_id | 290 } // namespace instance_id |
| OLD | NEW |