| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/context/blimp_client_context_impl.h" | 5 #include "blimp/client/core/context/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 UMA_HISTOGRAM_BOOLEAN("Blimp.Supported", true); | 152 UMA_HISTOGRAM_BOOLEAN("Blimp.Supported", true); |
| 153 } | 153 } |
| 154 | 154 |
| 155 BlimpClientContextImpl::~BlimpClientContextImpl() { | 155 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 156 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 156 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 157 connection_status_.RemoveObserver(this); | 157 connection_status_.RemoveObserver(this); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 160 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 161 DCHECK(!delegate_ && delegate); | 161 DCHECK(!delegate_ || !delegate); |
| 162 delegate_ = delegate; | 162 delegate_ = delegate; |
| 163 | 163 |
| 164 // TODO(xingliu): Pass the IdentityProvider needed by |assignment_fetcher_| | 164 // TODO(xingliu): Pass the IdentityProvider needed by |assignment_fetcher_| |
| 165 // in the constructor, see crbug/661848. | 165 // in the constructor, see crbug/661848. |
| 166 if (delegate_) { | 166 if (delegate_) { |
| 167 assignment_fetcher_ = base::MakeUnique<AssignmentFetcher>( | 167 assignment_fetcher_ = base::MakeUnique<AssignmentFetcher>( |
| 168 io_thread_task_runner_, file_thread_task_runner_, | 168 io_thread_task_runner_, file_thread_task_runner_, |
| 169 delegate_->CreateIdentityProvider(), GetAssignerURL(), | 169 delegate_->CreateIdentityProvider(), GetAssignerURL(), |
| 170 base::Bind(&BlimpClientContextImpl::OnAssignmentReceived, | 170 base::Bind(&BlimpClientContextImpl::OnAssignmentReceived, |
| 171 weak_factory_.GetWeakPtr()), | 171 weak_factory_.GetWeakPtr()), |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (result >= 0) { | 287 if (result >= 0) { |
| 288 delegate_->OnEngineDisconnected(result); | 288 delegate_->OnEngineDisconnected(result); |
| 289 } else { | 289 } else { |
| 290 delegate_->OnNetworkDisconnected(result); | 290 delegate_->OnNetworkDisconnected(result); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace client | 295 } // namespace client |
| 296 } // namespace blimp | 296 } // namespace blimp |
| OLD | NEW |