Chromium Code Reviews| 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/blimp_client_context_impl.h" | 5 #include "blimp/client/core/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/sequenced_task_runner_handle.h" | 10 #include "base/threading/sequenced_task_runner_handle.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 // registered. | 65 // registered. |
| 66 io_thread_task_runner_->PostTask( | 66 io_thread_task_runner_->PostTask( |
| 67 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, | 67 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, |
| 68 base::Unretained(net_components_.get()))); | 68 base::Unretained(net_components_.get()))); |
| 69 } | 69 } |
| 70 | 70 |
| 71 BlimpClientContextImpl::~BlimpClientContextImpl() { | 71 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 72 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 72 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void BlimpClientContextImpl::Connect() { | |
|
nyquist
2016/08/12 05:47:04
Nit: You see if it makes sense to order these func
xingliu
2016/08/12 21:11:18
Done.
| |
| 76 // Lazy initialization of IdentitySource. | |
| 77 if (!identity_source_) { | |
| 78 DCHECK(delegate_); | |
| 79 identity_source_ = | |
| 80 base::MakeUnique<IdentitySource>(delegate_->CreateIdentityProvider()); | |
| 81 identity_source_->SetDelegate(delegate_); | |
| 82 } | |
| 83 | |
| 84 // Start Blimp authentication flow. | |
| 85 identity_source_->Connect(); | |
| 86 } | |
| 87 | |
| 75 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 88 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 76 delegate_ = delegate; | 89 delegate_ = delegate; |
| 77 } | 90 } |
| 78 | 91 |
| 79 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() { | 92 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() { |
| 80 std::unique_ptr<BlimpContents> blimp_contents = | 93 std::unique_ptr<BlimpContents> blimp_contents = |
| 81 blimp_contents_manager_->CreateBlimpContents(); | 94 blimp_contents_manager_->CreateBlimpContents(); |
| 82 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); | 95 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); |
| 83 return blimp_contents; | 96 return blimp_contents; |
| 84 } | 97 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 } | 132 } |
| 120 | 133 |
| 121 io_thread_task_runner_->PostTask( | 134 io_thread_task_runner_->PostTask( |
| 122 FROM_HERE, | 135 FROM_HERE, |
| 123 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 136 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
| 124 base::Unretained(net_components_.get()), assignment)); | 137 base::Unretained(net_components_.get()), assignment)); |
| 125 } | 138 } |
| 126 | 139 |
| 127 } // namespace client | 140 } // namespace client |
| 128 } // namespace blimp | 141 } // namespace blimp |
| OLD | NEW |