| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/threading/sequenced_task_runner_handle.h" | 11 #include "base/threading/sequenced_task_runner_handle.h" |
| 12 #include "blimp/client/core/blimp_client_switches.h" | 12 #include "blimp/client/core/blimp_client_switches.h" |
| 13 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 13 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
| 14 #include "blimp/client/core/contents/blimp_contents_impl.h" | 14 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 15 #include "blimp/client/core/contents/blimp_contents_manager.h" | 15 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 16 #include "blimp/client/core/contents/ime_feature.h" | 16 #include "blimp/client/core/contents/ime_feature.h" |
| 17 #include "blimp/client/core/contents/navigation_feature.h" | 17 #include "blimp/client/core/contents/navigation_feature.h" |
| 18 #include "blimp/client/core/contents/tab_control_feature.h" | 18 #include "blimp/client/core/contents/tab_control_feature.h" |
| 19 #include "blimp/client/core/render_widget/render_widget_feature.h" | 19 #include "blimp/client/core/render_widget/render_widget_feature.h" |
| 20 #include "blimp/client/core/session/cross_thread_network_event_observer.h" | 20 #include "blimp/client/core/session/cross_thread_network_event_observer.h" |
| 21 #include "blimp/client/core/settings/settings_feature.h" | 21 #include "blimp/client/core/settings/settings_feature.h" |
| 22 #include "blimp/client/public/blimp_client_context_delegate.h" | 22 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 23 #include "blimp/client/public/compositor/compositor_dependencies.h" | 23 #include "blimp/client/public/compositor/compositor_dependencies.h" |
| 24 #include "ui/gfx/native_widget_types.h" |
| 24 | 25 |
| 25 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
| 26 #include "blimp/client/core/android/blimp_client_context_impl_android.h" | 27 #include "blimp/client/core/android/blimp_client_context_impl_android.h" |
| 27 #endif // OS_ANDROID | 28 #endif // OS_ANDROID |
| 28 | 29 |
| 29 namespace blimp { | 30 namespace blimp { |
| 30 namespace client { | 31 namespace client { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 const char kDefaultAssignerUrl[] = | 34 const char kDefaultAssignerUrl[] = |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 97 } |
| 97 | 98 |
| 98 BlimpClientContextImpl::~BlimpClientContextImpl() { | 99 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 99 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 100 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 103 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 103 delegate_ = delegate; | 104 delegate_ = delegate; |
| 104 } | 105 } |
| 105 | 106 |
| 106 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents() { | 107 std::unique_ptr<BlimpContents> BlimpClientContextImpl::CreateBlimpContents( |
| 108 gfx::NativeWindow window) { |
| 107 std::unique_ptr<BlimpContents> blimp_contents = | 109 std::unique_ptr<BlimpContents> blimp_contents = |
| 108 blimp_contents_manager_->CreateBlimpContents(); | 110 blimp_contents_manager_->CreateBlimpContents(window); |
| 109 if (blimp_contents) | 111 if (blimp_contents) |
| 110 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); | 112 delegate_->AttachBlimpContentsHelpers(blimp_contents.get()); |
| 111 return blimp_contents; | 113 return blimp_contents; |
| 112 } | 114 } |
| 113 | 115 |
| 114 void BlimpClientContextImpl::Connect() { | 116 void BlimpClientContextImpl::Connect() { |
| 115 // Start Blimp authentication flow. The OAuth2 token will be used in | 117 // Start Blimp authentication flow. The OAuth2 token will be used in |
| 116 // assignment source. | 118 // assignment source. |
| 117 GetIdentitySource()->Connect(); | 119 GetIdentitySource()->Connect(); |
| 118 } | 120 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 203 } |
| 202 | 204 |
| 203 void BlimpClientContextImpl::CreateIdentitySource() { | 205 void BlimpClientContextImpl::CreateIdentitySource() { |
| 204 identity_source_ = base::MakeUnique<IdentitySource>( | 206 identity_source_ = base::MakeUnique<IdentitySource>( |
| 205 delegate_, base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, | 207 delegate_, base::Bind(&BlimpClientContextImpl::ConnectToAssignmentSource, |
| 206 base::Unretained(this))); | 208 base::Unretained(this))); |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace client | 211 } // namespace client |
| 210 } // namespace blimp | 212 } // namespace blimp |
| OLD | NEW |