Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: blimp/client/core/blimp_client_context_impl.cc

Issue 2322843002: Propagate connection info to Blimp android UI. (Closed)
Patch Set: Merge conflicts. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.h ('k') | blimp/client/core/session/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 tab_control_feature_(new TabControlFeature), 83 tab_control_feature_(new TabControlFeature),
84 blimp_contents_manager_( 84 blimp_contents_manager_(
85 new BlimpContentsManager(blimp_compositor_dependencies_.get(), 85 new BlimpContentsManager(blimp_compositor_dependencies_.get(),
86 ime_feature_.get(), 86 ime_feature_.get(),
87 navigation_feature_.get(), 87 navigation_feature_.get(),
88 render_widget_feature_.get(), 88 render_widget_feature_.get(),
89 tab_control_feature_.get())), 89 tab_control_feature_.get())),
90 weak_factory_(this) { 90 weak_factory_(this) {
91 net_components_.reset(new ClientNetworkComponents( 91 net_components_.reset(new ClientNetworkComponents(
92 base::MakeUnique<CrossThreadNetworkEventObserver>( 92 base::MakeUnique<CrossThreadNetworkEventObserver>(
93 weak_factory_.GetWeakPtr(), base::SequencedTaskRunnerHandle::Get()))); 93 connection_status_.GetWeakPtr(),
94 base::SequencedTaskRunnerHandle::Get())));
94 95
95 // The |thread_pipe_manager_| must be set up correctly before features are 96 // The |thread_pipe_manager_| must be set up correctly before features are
96 // registered. 97 // registered.
97 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>( 98 thread_pipe_manager_ = base::MakeUnique<ThreadPipeManager>(
98 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler()); 99 io_thread_task_runner_, net_components_->GetBrowserConnectionHandler());
99 100
100 RegisterFeatures(); 101 RegisterFeatures();
101 InitializeSettings(); 102 InitializeSettings();
102 103
103 // Initialize must only be posted after the features have been 104 // Initialize must only be posted after the features have been
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_)); 148 GetAssignerURL(), io_thread_task_runner_, file_thread_task_runner_));
148 } 149 }
149 150
150 VLOG(1) << "Trying to get assignment."; 151 VLOG(1) << "Trying to get assignment.";
151 assignment_source_->GetAssignment( 152 assignment_source_->GetAssignment(
152 client_auth_token, 153 client_auth_token,
153 base::Bind(&BlimpClientContextImpl::OnAssignmentReceived, 154 base::Bind(&BlimpClientContextImpl::OnAssignmentReceived,
154 weak_factory_.GetWeakPtr())); 155 weak_factory_.GetWeakPtr()));
155 } 156 }
156 157
157 void BlimpClientContextImpl::OnConnected() {
158 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", true);
159 }
160
161 void BlimpClientContextImpl::OnDisconnected(int result) {
162 UMA_HISTOGRAM_BOOLEAN("Blimp.Connected", false);
163 }
164
165 GURL BlimpClientContextImpl::GetAssignerURL() { 158 GURL BlimpClientContextImpl::GetAssignerURL() {
166 return GURL(kDefaultAssignerUrl); 159 return GURL(kDefaultAssignerUrl);
167 } 160 }
168 161
169 IdentitySource* BlimpClientContextImpl::GetIdentitySource() { 162 IdentitySource* BlimpClientContextImpl::GetIdentitySource() {
170 if (!identity_source_) { 163 if (!identity_source_) {
171 CreateIdentitySource(); 164 CreateIdentitySource();
172 } 165 }
173 return identity_source_.get(); 166 return identity_source_.get();
174 } 167 }
175 168
169 ConnectionStatus* BlimpClientContextImpl::GetConnectionStatus() {
170 return &connection_status_;
171 }
172
176 void BlimpClientContextImpl::OnAssignmentReceived( 173 void BlimpClientContextImpl::OnAssignmentReceived(
177 AssignmentRequestResult result, 174 AssignmentRequestResult result,
178 const Assignment& assignment) { 175 const Assignment& assignment) {
179 VLOG(1) << "Assignment result: " << result; 176 VLOG(1) << "Assignment result: " << result;
180 177
178 // Cache engine info.
179 connection_status_.OnAssignmentResult(result, assignment);
180
181 // Inform the embedder of the assignment result.
181 if (delegate_) { 182 if (delegate_) {
182 delegate_->OnAssignmentConnectionAttempted(result, assignment); 183 delegate_->OnAssignmentConnectionAttempted(result, assignment);
183 } 184 }
184 185
185 if (result != ASSIGNMENT_REQUEST_RESULT_OK) { 186 if (result != ASSIGNMENT_REQUEST_RESULT_OK) {
186 LOG(ERROR) << "Assignment failed, reason: " << result; 187 LOG(ERROR) << "Assignment failed, reason: " << result;
187 return; 188 return;
188 } 189 }
189 190
190 ConnectWithAssignment(assignment); 191 ConnectWithAssignment(assignment);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Currently we just drop the connection on image decoding error. 236 // Currently we just drop the connection on image decoding error.
236 io_thread_task_runner_->PostTask( 237 io_thread_task_runner_->PostTask(
237 FROM_HERE, 238 FROM_HERE,
238 base::Bind( 239 base::Bind(
239 &BrowserConnectionHandler::DropCurrentConnection, 240 &BrowserConnectionHandler::DropCurrentConnection,
240 base::Unretained(net_components_->GetBrowserConnectionHandler()))); 241 base::Unretained(net_components_->GetBrowserConnectionHandler())));
241 } 242 }
242 243
243 } // namespace client 244 } // namespace client
244 } // namespace blimp 245 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.h ('k') | blimp/client/core/session/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698