| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/session/blimp_client_session.h" | 5 #include "blimp/client/session/blimp_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release()); | 75 io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BlimpClientSession::Connect(const std::string& client_auth_token) { | 78 void BlimpClientSession::Connect(const std::string& client_auth_token) { |
| 79 VLOG(1) << "Trying to get assignment."; | 79 VLOG(1) << "Trying to get assignment."; |
| 80 assignment_source_->GetAssignment( | 80 assignment_source_->GetAssignment( |
| 81 client_auth_token, base::Bind(&BlimpClientSession::ConnectWithAssignment, | 81 client_auth_token, base::Bind(&BlimpClientSession::ConnectWithAssignment, |
| 82 weak_factory_.GetWeakPtr())); | 82 weak_factory_.GetWeakPtr())); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void BlimpClientSession::ConnectWithAssignment(AssignmentSource::Result result, | 85 void BlimpClientSession::ConnectWithAssignment(AssignmentRequestResult result, |
| 86 const Assignment& assignment) { | 86 const Assignment& assignment) { |
| 87 OnAssignmentConnectionAttempted(result, assignment); | 87 OnAssignmentConnectionAttempted(result, assignment); |
| 88 | 88 |
| 89 if (result != AssignmentSource::Result::RESULT_OK) { | 89 if (result != ASSIGNMENT_REQUEST_RESULT_OK) { |
| 90 LOG(ERROR) << "Assignment failed, reason: " << result; | 90 LOG(ERROR) << "Assignment failed, reason: " << result; |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 VLOG(1) << "Assignment succeeded"; | 94 VLOG(1) << "Assignment succeeded"; |
| 95 | 95 |
| 96 io_thread_.task_runner()->PostTask( | 96 io_thread_.task_runner()->PostTask( |
| 97 FROM_HERE, | 97 FROM_HERE, |
| 98 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, | 98 base::Bind(&ClientNetworkComponents::ConnectWithAssignment, |
| 99 base::Unretained(net_components_.get()), assignment)); | 99 base::Unretained(net_components_.get()), assignment)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void BlimpClientSession::OnAssignmentConnectionAttempted( | 102 void BlimpClientSession::OnAssignmentConnectionAttempted( |
| 103 AssignmentSource::Result result, | 103 AssignmentRequestResult result, |
| 104 const Assignment& assignment) {} | 104 const Assignment& assignment) {} |
| 105 | 105 |
| 106 void BlimpClientSession::RegisterFeatures() { | 106 void BlimpClientSession::RegisterFeatures() { |
| 107 thread_pipe_manager_ = base::WrapUnique( | 107 thread_pipe_manager_ = base::WrapUnique( |
| 108 new ThreadPipeManager(io_thread_.task_runner(), | 108 new ThreadPipeManager(io_thread_.task_runner(), |
| 109 net_components_->GetBrowserConnectionHandler())); | 109 net_components_->GetBrowserConnectionHandler())); |
| 110 | 110 |
| 111 // Register features' message senders and receivers. | 111 // Register features' message senders and receivers. |
| 112 tab_control_feature_->set_outgoing_message_processor( | 112 tab_control_feature_->set_outgoing_message_processor( |
| 113 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, | 113 thread_pipe_manager_->RegisterFeature(BlimpMessage::kTabControl, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return settings_feature_.get(); | 173 return settings_feature_.get(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 BlimpConnectionStatistics* BlimpClientSession::GetBlimpConnectionStatistics() | 176 BlimpConnectionStatistics* BlimpClientSession::GetBlimpConnectionStatistics() |
| 177 const { | 177 const { |
| 178 return blimp_connection_statistics_; | 178 return blimp_connection_statistics_; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace client | 181 } // namespace client |
| 182 } // namespace blimp | 182 } // namespace blimp |
| OLD | NEW |