| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 // test::mojom::BlockedInterface: | 166 // test::mojom::BlockedInterface: |
| 167 void GetTitleBlocked(const GetTitleBlockedCallback& callback) override { | 167 void GetTitleBlocked(const GetTitleBlockedCallback& callback) override { |
| 168 callback.Run("Called Blocked Interface!"); | 168 callback.Run("Called Blocked Interface!"); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // test::mojom::UserIdTest: | 171 // test::mojom::UserIdTest: |
| 172 void ConnectToClassAppAsDifferentUser( | 172 void ConnectToClassAppAsDifferentUser( |
| 173 const service_manager::Identity& target, | 173 const service_manager::Identity& target, |
| 174 const ConnectToClassAppAsDifferentUserCallback& callback) override { | 174 const ConnectToClassAppAsDifferentUserCallback& callback) override { |
| 175 Connector::ConnectParams params(target); | |
| 176 std::unique_ptr<Connection> connection = | 175 std::unique_ptr<Connection> connection = |
| 177 context()->connector()->Connect(¶ms); | 176 context()->connector()->Connect(target); |
| 178 { | 177 { |
| 179 base::RunLoop loop; | 178 base::RunLoop loop; |
| 180 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop)); | 179 connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop)); |
| 181 base::MessageLoop::ScopedNestableTaskAllower allow( | 180 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 182 base::MessageLoop::current()); | 181 base::MessageLoop::current()); |
| 183 loop.Run(); | 182 loop.Run(); |
| 184 } | 183 } |
| 185 callback.Run(static_cast<int32_t>(connection->GetResult()), | 184 callback.Run(static_cast<int32_t>(connection->GetResult()), |
| 186 connection->GetRemoteIdentity()); | 185 connection->GetRemoteIdentity()); |
| 187 } | 186 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 214 | 213 |
| 215 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp); | 214 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp); |
| 216 }; | 215 }; |
| 217 | 216 |
| 218 } // namespace service_manager | 217 } // namespace service_manager |
| 219 | 218 |
| 220 MojoResult ServiceMain(MojoHandle service_request_handle) { | 219 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 221 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp); | 220 service_manager::ServiceRunner runner(new service_manager::ConnectTestApp); |
| 222 return runner.Run(service_request_handle); | 221 return runner.Run(service_request_handle); |
| 223 } | 222 } |
| OLD | NEW |