| Index: components/gcm_driver/instance_id/instance_id_impl.cc
|
| diff --git a/components/gcm_driver/instance_id/instance_id_impl.cc b/components/gcm_driver/instance_id/instance_id_impl.cc
|
| index 9a99a79ddf2ab1def12ce36a7241dfa33a4ebaea..f1d458014912dde2c1ba35095b1f1803c5f66ba3 100644
|
| --- a/components/gcm_driver/instance_id/instance_id_impl.cc
|
| +++ b/components/gcm_driver/instance_id/instance_id_impl.cc
|
| @@ -54,13 +54,10 @@ scoped_ptr<InstanceID> InstanceID::Create(const std::string& app_id,
|
|
|
| InstanceIDImpl::InstanceIDImpl(const std::string& app_id,
|
| gcm::GCMDriver* gcm_driver)
|
| - : InstanceID(app_id),
|
| - gcm_driver_(gcm_driver),
|
| - weak_ptr_factory_(this) {
|
| - GetInstanceIDHandler()->GetInstanceIDData(
|
| - app_id,
|
| - base::Bind(&InstanceIDImpl::GetInstanceIDDataCompleted,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| + : InstanceID(app_id, gcm_driver), weak_ptr_factory_(this) {
|
| + handler_->GetInstanceIDData(
|
| + app_id, base::Bind(&InstanceIDImpl::GetInstanceIDDataCompleted,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| InstanceIDImpl::~InstanceIDImpl() {
|
| @@ -129,14 +126,9 @@ void InstanceIDImpl::DoGetToken(
|
| const GetTokenCallback& callback) {
|
| EnsureIDGenerated();
|
|
|
| - GetInstanceIDHandler()->GetToken(
|
| - app_id(),
|
| - authorized_entity,
|
| - scope,
|
| - options,
|
| - base::Bind(&InstanceIDImpl::OnGetTokenCompleted,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - callback));
|
| + handler_->GetToken(app_id(), authorized_entity, scope, options,
|
| + base::Bind(&InstanceIDImpl::OnGetTokenCompleted,
|
| + weak_ptr_factory_.GetWeakPtr(), callback));
|
| }
|
|
|
| void InstanceIDImpl::DeleteToken(const std::string& authorized_entity,
|
| @@ -168,13 +160,9 @@ void InstanceIDImpl::DoDeleteToken(
|
| return;
|
| }
|
|
|
| - GetInstanceIDHandler()->DeleteToken(
|
| - app_id(),
|
| - authorized_entity,
|
| - scope,
|
| - base::Bind(&InstanceIDImpl::OnDeleteTokenCompleted,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - callback));
|
| + handler_->DeleteToken(app_id(), authorized_entity, scope,
|
| + base::Bind(&InstanceIDImpl::OnDeleteTokenCompleted,
|
| + weak_ptr_factory_.GetWeakPtr(), callback));
|
| }
|
|
|
| void InstanceIDImpl::DeleteID(const DeleteIDCallback& callback) {
|
| @@ -196,13 +184,11 @@ void InstanceIDImpl::DoDeleteID(const DeleteIDCallback& callback) {
|
| return;
|
| }
|
|
|
| - GetInstanceIDHandler()->DeleteAllTokensForApp(
|
| - app_id(),
|
| - base::Bind(&InstanceIDImpl::OnDeleteIDCompleted,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - callback));
|
| + handler_->DeleteAllTokensForApp(
|
| + app_id(), base::Bind(&InstanceIDImpl::OnDeleteIDCompleted,
|
| + weak_ptr_factory_.GetWeakPtr(), callback));
|
|
|
| - GetInstanceIDHandler()->RemoveInstanceIDData(app_id());
|
| + handler_->RemoveInstanceIDData(app_id());
|
|
|
| id_.clear();
|
| creation_time_ = base::Time();
|
| @@ -245,12 +231,6 @@ void InstanceIDImpl::GetInstanceIDDataCompleted(
|
| delayed_task_controller_.SetReady();
|
| }
|
|
|
| -gcm::InstanceIDHandler* InstanceIDImpl::GetInstanceIDHandler() const {
|
| - gcm::InstanceIDHandler* handler = gcm_driver_->GetInstanceIDHandler();
|
| - DCHECK(handler);
|
| - return handler;
|
| -}
|
| -
|
| void InstanceIDImpl::EnsureIDGenerated() {
|
| if (!id_.empty())
|
| return;
|
| @@ -281,10 +261,8 @@ void InstanceIDImpl::EnsureIDGenerated() {
|
| creation_time_ = base::Time::Now();
|
|
|
| // Save to the persistent store.
|
| - GetInstanceIDHandler()->AddInstanceIDData(
|
| - app_id(),
|
| - id_,
|
| - base::Int64ToString(creation_time_.ToInternalValue()));
|
| + handler_->AddInstanceIDData(
|
| + app_id(), id_, base::Int64ToString(creation_time_.ToInternalValue()));
|
| }
|
|
|
| } // namespace instance_id
|
|
|