| 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 "mojo/shell/public/cpp/lib/connector_impl.h" | 5 #include "mojo/shell/public/cpp/lib/connector_impl.h" |
| 6 | 6 |
| 7 #include "mojo/shell/public/cpp/lib/connection_impl.h" | 7 #include "mojo/shell/public/cpp/lib/connection_impl.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 | 10 |
| 11 Connector::ConnectParams::ConnectParams(const std::string& url) | 11 Connector::ConnectParams::ConnectParams(const std::string& url) |
| 12 : url_(url), | 12 : url_(url), |
| 13 user_id_(shell::mojom::Connector::kUserInherit) { | 13 user_id_(shell::mojom::Connector::kUserInherit) { |
| 14 } | 14 } |
| 15 Connector::ConnectParams::~ConnectParams() {} | 15 Connector::ConnectParams::~ConnectParams() {} |
| 16 | 16 |
| 17 ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtrInfo unbound_state) | 17 ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtrInfo unbound_state) |
| 18 : unbound_state_(std::move(unbound_state)) {} | 18 : unbound_state_(std::move(unbound_state)) {} |
| 19 ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtr connector, |
| 20 const base::Closure& connection_error_closure) |
| 21 : connector_(std::move(connector)) { |
| 22 connector_.set_connection_error_handler(connection_error_closure); |
| 23 thread_checker_.reset(new base::ThreadChecker); |
| 24 } |
| 19 ConnectorImpl::~ConnectorImpl() {} | 25 ConnectorImpl::~ConnectorImpl() {} |
| 20 | 26 |
| 21 scoped_ptr<Connection> ConnectorImpl::Connect(const std::string& url) { | 27 scoped_ptr<Connection> ConnectorImpl::Connect(const std::string& url) { |
| 22 ConnectParams params(url); | 28 ConnectParams params(url); |
| 23 return Connect(¶ms); | 29 return Connect(¶ms); |
| 24 } | 30 } |
| 25 | 31 |
| 26 scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) { | 32 scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) { |
| 27 // Bind this object to the current thread the first time it is used to | 33 // Bind this object to the current thread the first time it is used to |
| 28 // connect. | 34 // connect. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 67 } |
| 62 | 68 |
| 63 scoped_ptr<Connector> ConnectorImpl::Clone() { | 69 scoped_ptr<Connector> ConnectorImpl::Clone() { |
| 64 shell::mojom::ConnectorPtr connector; | 70 shell::mojom::ConnectorPtr connector; |
| 65 connector_->Clone(GetProxy(&connector)); | 71 connector_->Clone(GetProxy(&connector)); |
| 66 return make_scoped_ptr( | 72 return make_scoped_ptr( |
| 67 new ConnectorImpl(connector.PassInterface())); | 73 new ConnectorImpl(connector.PassInterface())); |
| 68 } | 74 } |
| 69 | 75 |
| 70 } // namespace mojo | 76 } // namespace mojo |
| OLD | NEW |