| 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 "services/service_manager/tests/lifecycle/app_client.h" |   5 #include "services/service_manager/tests/lifecycle/app_client.h" | 
|   6  |   6  | 
|   7 #include "base/macros.h" |   7 #include "base/macros.h" | 
|   8 #include "services/service_manager/public/cpp/interface_registry.h" |  | 
|   9 #include "services/service_manager/public/cpp/service_context.h" |   8 #include "services/service_manager/public/cpp/service_context.h" | 
|  10  |   9  | 
|  11 namespace service_manager { |  10 namespace service_manager { | 
|  12 namespace test { |  11 namespace test { | 
|  13  |  12  | 
|  14 AppClient::AppClient() {} |  13 AppClient::AppClient() { | 
 |  14   registry_.AddInterface<mojom::LifecycleControl>(this); | 
 |  15 } | 
|  15  |  16  | 
|  16 AppClient::~AppClient() {} |  17 AppClient::~AppClient() {} | 
|  17  |  18  | 
|  18 bool AppClient::OnConnect(const ServiceInfo& remote_info, |  19 void AppClient::OnBindInterface(const ServiceInfo& source_info, | 
|  19                           InterfaceRegistry* registry) { |  20                                 const std::string& interface_name, | 
|  20   registry->AddInterface<mojom::LifecycleControl>(this); |  21                                 mojo::ScopedMessagePipeHandle interface_pipe) { | 
|  21   return true; |  22   registry_.BindInterface(source_info.identity, interface_name, | 
 |  23                           std::move(interface_pipe)); | 
|  22 } |  24 } | 
|  23  |  25  | 
|  24 bool AppClient::OnServiceManagerConnectionLost() { |  26 bool AppClient::OnServiceManagerConnectionLost() { | 
|  25   base::MessageLoop::current()->QuitWhenIdle(); |  27   base::MessageLoop::current()->QuitWhenIdle(); | 
|  26   return true; |  28   return true; | 
|  27 } |  29 } | 
|  28  |  30  | 
|  29 void AppClient::Create(const Identity& remote_identity, |  31 void AppClient::Create(const Identity& remote_identity, | 
|  30                        mojom::LifecycleControlRequest request) { |  32                        mojom::LifecycleControlRequest request) { | 
|  31   bindings_.AddBinding(this, std::move(request)); |  33   bindings_.AddBinding(this, std::move(request)); | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
|  52       base::Bind(&AppClient::BindingLost, base::Unretained(this))); |  54       base::Bind(&AppClient::BindingLost, base::Unretained(this))); | 
|  53 } |  55 } | 
|  54  |  56  | 
|  55 void AppClient::BindingLost() { |  57 void AppClient::BindingLost() { | 
|  56   if (bindings_.empty()) |  58   if (bindings_.empty()) | 
|  57     OnServiceManagerConnectionLost(); |  59     OnServiceManagerConnectionLost(); | 
|  58 } |  60 } | 
|  59  |  61  | 
|  60 }  // namespace test |  62 }  // namespace test | 
|  61 }  // namespace service_manager |  63 }  // namespace service_manager | 
| OLD | NEW |