| 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 <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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/threading/sequenced_task_runner_handle.h" | 14 #include "base/threading/sequenced_task_runner_handle.h" |
| 14 #include "blimp/client/core/blimp_client_switches.h" | 15 #include "blimp/client/core/blimp_client_switches.h" |
| 15 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 16 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
| 16 #include "blimp/client/core/compositor/blob_channel_feature.h" | 17 #include "blimp/client/core/compositor/blob_channel_feature.h" |
| 17 #include "blimp/client/core/contents/blimp_contents_impl.h" | 18 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 18 #include "blimp/client/core/contents/blimp_contents_manager.h" | 19 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 19 #include "blimp/client/core/contents/ime_feature.h" | 20 #include "blimp/client/core/contents/ime_feature.h" |
| 20 #include "blimp/client/core/contents/navigation_feature.h" | 21 #include "blimp/client/core/contents/navigation_feature.h" |
| 21 #include "blimp/client/core/contents/tab_control_feature.h" | 22 #include "blimp/client/core/contents/tab_control_feature.h" |
| 22 #include "blimp/client/core/geolocation/geolocation_feature.h" | 23 #include "blimp/client/core/geolocation/geolocation_feature.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); | 98 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); |
| 98 | 99 |
| 99 RegisterFeatures(); | 100 RegisterFeatures(); |
| 100 InitializeSettings(); | 101 InitializeSettings(); |
| 101 | 102 |
| 102 // Initialize must only be posted after the features have been | 103 // Initialize must only be posted after the features have been |
| 103 // registered. | 104 // registered. |
| 104 io_thread_task_runner_->PostTask( | 105 io_thread_task_runner_->PostTask( |
| 105 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, | 106 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, |
| 106 base::Unretained(net_components_.get()))); | 107 base::Unretained(net_components_.get()))); |
| 108 |
| 109 UMA_HISTOGRAM_BOOLEAN("Blimp.Supported", true); |
| 107 } | 110 } |
| 108 | 111 |
| 109 BlimpClientContextImpl::~BlimpClientContextImpl() { | 112 BlimpClientContextImpl::~BlimpClientContextImpl() { |
| 110 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); | 113 io_thread_task_runner_->DeleteSoon(FROM_HERE, net_components_.release()); |
| 111 } | 114 } |
| 112 | 115 |
| 113 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { | 116 void BlimpClientContextImpl::SetDelegate(BlimpClientContextDelegate* delegate) { |
| 114 delegate_ = delegate; | 117 delegate_ = delegate; |
| 115 } | 118 } |
| 116 | 119 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 136 GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_)); | 139 GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_)); |
| 137 } | 140 } |
| 138 | 141 |
| 139 VLOG(1) << "Trying to get assignment."; | 142 VLOG(1) << "Trying to get assignment."; |
| 140 assignment_source_->GetAssignment( | 143 assignment_source_->GetAssignment( |
| 141 client_auth_token, | 144 client_auth_token, |
| 142 base::Bind(&BlimpClientContextImpl::ConnectWithAssignment, | 145 base::Bind(&BlimpClientContextImpl::ConnectWithAssignment, |
| 143 weak_factory_.GetWeakPtr())); | 146 weak_factory_.GetWeakPtr())); |
| 144 } | 147 } |
| 145 | 148 |
| 146 void BlimpClientContextImpl::OnConnected() {} | 149 void BlimpClientContextImpl::OnConnected() { |
| 150 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", true); |
| 151 } |
| 147 | 152 |
| 148 void BlimpClientContextImpl::OnDisconnected(int result) {} | 153 void BlimpClientContextImpl::OnDisconnected(int result) { |
| 154 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", false); |
| 155 } |
| 149 | 156 |
| 150 GURL BlimpClientContextImpl::GetAssignerURL() { | 157 GURL BlimpClientContextImpl::GetAssignerURL() { |
| 151 return GURL(kDefaultAssignerUrl); | 158 return GURL(kDefaultAssignerUrl); |
| 152 } | 159 } |
| 153 | 160 |
| 154 IdentitySource* BlimpClientContextImpl::GetIdentitySource() { | 161 IdentitySource* BlimpClientContextImpl::GetIdentitySource() { |
| 155 if (!identity_source_) { | 162 if (!identity_source_) { |
| 156 CreateIdentitySource(); | 163 CreateIdentitySource(); |
| 157 } | 164 } |
| 158 return identity_source_.get(); | 165 return identity_source_.get(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Currently we just drop the connection on image decoding error. | 230 // Currently we just drop the connection on image decoding error. |
| 224 io_thread_task_runner_->PostTask( | 231 io_thread_task_runner_->PostTask( |
| 225 FROM_HERE, | 232 FROM_HERE, |
| 226 base::Bind( | 233 base::Bind( |
| 227 &BrowserConnectionHandler::DropCurrentConnection, | 234 &BrowserConnectionHandler::DropCurrentConnection, |
| 228 base::Unretained(net_components_->GetBrowserConnectionHandler()))); | 235 base::Unretained(net_components_->GetBrowserConnectionHandler()))); |
| 229 } | 236 } |
| 230 | 237 |
| 231 } // namespace client | 238 } // namespace client |
| 232 } // namespace blimp | 239 } // namespace blimp |
| OLD | NEW |