| 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" |
| 11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 11 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 12 #include "blimp/client/core/contents/blimp_contents_manager.h" | 12 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 13 #include "blimp/client/core/contents/ime_feature.h" | 13 #include "blimp/client/core/contents/ime_feature.h" |
| 14 #include "blimp/client/core/contents/navigation_feature.h" | 14 #include "blimp/client/core/contents/navigation_feature.h" |
| 15 #include "blimp/client/core/contents/tab_control_feature.h" | 15 #include "blimp/client/core/contents/tab_control_feature.h" |
| 16 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 16 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| 17 #include "blimp/client/public/blimp_client_context_delegate.h" | 17 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 18 #include "ui/gfx/native_widget_types.h" |
| 18 | 19 |
| 19 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 20 #include "blimp/client/core/android/blimp_client_context_impl_android.h" | 21 #include "blimp/client/core/android/blimp_client_context_impl_android.h" |
| 21 #endif // OS_ANDROID | 22 #endif // OS_ANDROID |
| 22 | 23 |
| 23 namespace blimp { | 24 namespace blimp { |
| 24 namespace client { | 25 namespace client { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 const char kDefaultAssignerUrl[] = | 28 const char kDefaultAssignerUrl[] = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 79 } |
| 79 | 80 |
| 80 BlimpClientContextImpl::~BlimpClientContextImpl() { | 81 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 81 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 82 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 82 } | 83 } |
| 83 | 84 |
| 84 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 85 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 85 delegate_ = delegate; | 86 delegate_ = delegate; |
| 86 } | 87 } |
| 87 | 88 |
| 88 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() { | 89 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents( |
| 90 gfx::NativeWindow window) { |
| 89 std::unique_ptr<BlimpContents> blimp_contents = | 91 std::unique_ptr<BlimpContents> blimp_contents = |
| 90 blimp_contents_manager_->CreateBlimpContents(); | 92 blimp_contents_manager_->CreateBlimpContents(window); |
| 91 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); | 93 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); |
| 92 return blimp_contents; | 94 return blimp_contents; |
| 93 } | 95 } |
| 94 | 96 |
| 95 void BlimpClientContextImpl::Connect() { | 97 void BlimpClientContextImpl::Connect() { |
| 96 // Lazy initialization of IdentitySource. | 98 // Lazy initialization of IdentitySource. |
| 97 if (!identity_source_) { | 99 if (!identity_source_) { |
| 98 identity_source_ = base::MakeUnique<IdentitySource>( | 100 identity_source_ = base::MakeUnique<IdentitySource>( |
| 99 delegate_, | 101 delegate_, |
| 100 base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, | 102 base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 navigation_feature_->set_outgoing_message_processor( | 162 navigation_feature_->set_outgoing_message_processor( |
| 161 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, | 163 thread_pipe_manager_->RegisterFeature(BlimpMessage::kNavigation, |
| 162 navigation_feature_.get())); | 164 navigation_feature_.get())); |
| 163 tab_control_feature_->set_outgoing_message_processor( | 165 tab_control_feature_->set_outgoing_message_processor( |
| 164 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, | 166 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, |
| 165 tab_control_feature_.get())); | 167 tab_control_feature_.get())); |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace client | 170 } // namespace client |
| 169 } // namespace blimp | 171 } // namespace blimp |
| OLD | NEW |