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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { | 104 base::WeakPtr<Connection> ConnectionImpl::GetWeakPtr() { |
105 return weak_factory_.GetWeakPtr(); | 105 return weak_factory_.GetWeakPtr(); |
106 } | 106 } |
107 | 107 |
108 //////////////////////////////////////////////////////////////////////////////// | 108 //////////////////////////////////////////////////////////////////////////////// |
109 // ConnectionImpl, private: | 109 // ConnectionImpl, private: |
110 | 110 |
111 void ConnectionImpl::OnConnectionCompleted(shell::mojom::ConnectResult result, | 111 void ConnectionImpl::OnConnectionCompleted(shell::mojom::ConnectResult result, |
112 const std::string& target_user_id, | 112 mojo::String target_user_id, |
113 uint32_t target_application_id) { | 113 uint32_t target_application_id) { |
114 DCHECK(State::PENDING == state_); | 114 DCHECK(State::PENDING == state_); |
115 | 115 |
116 result_ = result; | 116 result_ = result; |
117 state_ = result_ == shell::mojom::ConnectResult::SUCCEEDED ? | 117 state_ = result_ == shell::mojom::ConnectResult::SUCCEEDED ? |
118 State::CONNECTED : State::DISCONNECTED; | 118 State::CONNECTED : State::DISCONNECTED; |
119 remote_id_ = target_application_id; | 119 remote_id_ = target_application_id; |
120 remote_.set_user_id(target_user_id); | 120 remote_.set_user_id(target_user_id); |
121 std::vector<mojo::Closure> callbacks; | 121 std::vector<mojo::Closure> callbacks; |
122 callbacks.swap(connection_completed_callbacks_); | 122 callbacks.swap(connection_completed_callbacks_); |
123 for (auto callback : callbacks) | 123 for (auto callback : callbacks) |
124 callback.Run(); | 124 callback.Run(); |
125 } | 125 } |
126 | 126 |
127 } // namespace internal | 127 } // namespace internal |
128 } // namespace shell | 128 } // namespace shell |
OLD | NEW |