| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/public/test/test_service.h" | 5 #include "content/public/test/test_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "services/service_manager/public/cpp/connector.h" | 11 #include "services/service_manager/public/cpp/connector.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 const char kTestServiceUrl[] = "system:content_test_service"; | 15 const char kTestServiceUrl[] = "system:content_test_service"; |
| 16 | 16 |
| 17 TestService::TestService() : service_binding_(this) { | 17 TestService::TestService() : service_binding_(this) { |
| 18 registry_.AddInterface<mojom::TestService>(this); | 18 registry_.AddInterface<mojom::TestService>(this); |
| 19 } | 19 } |
| 20 | 20 |
| 21 TestService::~TestService() { | 21 TestService::~TestService() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void TestService::OnBindInterface( | 24 void TestService::OnBindInterface( |
| 25 const service_manager::ServiceInfo& source_info, | 25 const service_manager::BindSourceInfo& source_info, |
| 26 const std::string& interface_name, | 26 const std::string& interface_name, |
| 27 mojo::ScopedMessagePipeHandle interface_pipe) { | 27 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 28 requestor_name_ = source_info.identity.name(); | 28 requestor_name_ = source_info.identity.name(); |
| 29 registry_.BindInterface(source_info.identity, interface_name, | 29 registry_.BindInterface(source_info.identity, interface_name, |
| 30 std::move(interface_pipe)); | 30 std::move(interface_pipe)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void TestService::Create(const service_manager::Identity& remote_identity, | 33 void TestService::Create(const service_manager::Identity& remote_identity, |
| 34 mojom::TestServiceRequest request) { | 34 mojom::TestServiceRequest request) { |
| 35 DCHECK(!service_binding_.is_bound()); | 35 DCHECK(!service_binding_.is_bound()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 callback.Run(requestor_name_); | 54 callback.Run(requestor_name_); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void TestService::CreateSharedBuffer( | 57 void TestService::CreateSharedBuffer( |
| 58 const std::string& message, | 58 const std::string& message, |
| 59 const CreateSharedBufferCallback& callback) { | 59 const CreateSharedBufferCallback& callback) { |
| 60 NOTREACHED(); | 60 NOTREACHED(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace content | 63 } // namespace content |
| OLD | NEW |