| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/shell/public/cpp/lib/connection_impl.h" | 5 #include "services/shell/public/cpp/lib/connection_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 else | 91 else |
| 92 callback.Run(); | 92 callback.Run(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool ConnectionImpl::AllowsInterface(const std::string& interface_name) const { | 95 bool ConnectionImpl::AllowsInterface(const std::string& interface_name) const { |
| 96 return allow_all_interfaces_ || | 96 return allow_all_interfaces_ || |
| 97 capability_request_.interfaces.count(interface_name); | 97 capability_request_.interfaces.count(interface_name); |
| 98 } | 98 } |
| 99 | 99 |
| 100 mojom::InterfaceProvider* ConnectionImpl::GetRemoteInterfaceProvider() { | 100 mojom::InterfaceProvider* ConnectionImpl::GetRemoteInterfaceProvider() { |
| 101 return remote_interfaces_.GetInterfaceProvider(); | 101 return remote_interfaces_.get(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 InterfaceRegistry* ConnectionImpl::GetInterfaceRegistry() { | 104 InterfaceRegistry* ConnectionImpl::GetInterfaceRegistry() { |
| 105 return &interfaces_; | 105 return &interfaces_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 RemoteInterfaceRegistry* ConnectionImpl::GetRemoteInterfaceRegistry() { | 108 InterfaceProvider* ConnectionImpl::GetRemoteInterfaces() { |
| 109 return &remote_interfaces_; | 109 return &remote_interfaces_; |
| 110 } | 110 } |
| 111 | 111 |
| 112 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { | 112 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { |
| 113 return weak_factory_.GetWeakPtr(); | 113 return weak_factory_.GetWeakPtr(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 //////////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////////// |
| 117 // ConnectionImpl, private: | 117 // ConnectionImpl, private: |
| 118 | 118 |
| 119 void ConnectionImpl::OnConnectionCompleted(shell::mojom::ConnectResult result, | 119 void ConnectionImpl::OnConnectionCompleted(shell::mojom::ConnectResult result, |
| 120 mojo::String target_user_id, | 120 mojo::String target_user_id, |
| 121 uint32_t target_application_id) { | 121 uint32_t target_application_id) { |
| 122 DCHECK(State::PENDING == state_); | 122 DCHECK(State::PENDING == state_); |
| 123 | 123 |
| 124 result_ = result; | 124 result_ = result; |
| 125 state_ = result_ == shell::mojom::ConnectResult::SUCCEEDED ? | 125 state_ = result_ == shell::mojom::ConnectResult::SUCCEEDED ? |
| 126 State::CONNECTED : State::DISCONNECTED; | 126 State::CONNECTED : State::DISCONNECTED; |
| 127 remote_id_ = target_application_id; | 127 remote_id_ = target_application_id; |
| 128 remote_.set_user_id(target_user_id); | 128 remote_.set_user_id(target_user_id); |
| 129 std::vector<base::Closure> callbacks; | 129 std::vector<base::Closure> callbacks; |
| 130 callbacks.swap(connection_completed_callbacks_); | 130 callbacks.swap(connection_completed_callbacks_); |
| 131 for (auto callback : callbacks) | 131 for (auto callback : callbacks) |
| 132 callback.Run(); | 132 callback.Run(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace internal | 135 } // namespace internal |
| 136 } // namespace shell | 136 } // namespace shell |
| OLD | NEW |