| 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 #ifndef CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ | 6 #define CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 11 #include "mojo/public/cpp/system/message_pipe.h" | 10 #include "mojo/public/cpp/system/message_pipe.h" |
| 12 #include "third_party/WebKit/public/platform/ServiceRegistry.h" | 11 #include "third_party/WebKit/public/platform/ServiceRegistry.h" |
| 13 | 12 |
| 14 namespace base { | |
| 15 class SingleThreadTaskRunner; | |
| 16 } | |
| 17 | |
| 18 namespace content { | 13 namespace content { |
| 19 | 14 |
| 20 class ServiceRegistry; | 15 class ServiceRegistry; |
| 21 | 16 |
| 22 // An implementation of blink::ServiceRegistry that forwards to a | 17 // An implementation of blink::ServiceRegistry that forwards to a |
| 23 // content::ServiceRegistry. | 18 // content::ServiceRegistry. |
| 24 class BlinkServiceRegistryImpl : public blink::ServiceRegistry { | 19 class BlinkServiceRegistryImpl : public blink::ServiceRegistry { |
| 25 public: | 20 public: |
| 26 explicit BlinkServiceRegistryImpl( | 21 explicit BlinkServiceRegistryImpl( |
| 27 base::WeakPtr<content::ServiceRegistry> service_registry); | 22 base::WeakPtr<content::ServiceRegistry> service_registry); |
| 28 ~BlinkServiceRegistryImpl(); | 23 ~BlinkServiceRegistryImpl(); |
| 29 | 24 |
| 30 // blink::ServiceRegistry override. | 25 // blink::ServiceRegistry override. |
| 31 void connectToRemoteService(const char* name, | 26 void connectToRemoteService(const char* name, |
| 32 mojo::ScopedMessagePipeHandle handle) override; | 27 mojo::ScopedMessagePipeHandle handle) override; |
| 33 | 28 |
| 34 private: | 29 private: |
| 35 const base::WeakPtr<content::ServiceRegistry> service_registry_; | 30 const base::WeakPtr<content::ServiceRegistry> service_registry_; |
| 36 | 31 |
| 37 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | |
| 38 | |
| 39 base::WeakPtrFactory<BlinkServiceRegistryImpl> weak_ptr_factory_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(BlinkServiceRegistryImpl); | 32 DISALLOW_COPY_AND_ASSIGN(BlinkServiceRegistryImpl); |
| 42 }; | 33 }; |
| 43 | 34 |
| 44 } // namespace content | 35 } // namespace content |
| 45 | 36 |
| 46 #endif // CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ | 37 #endif // CONTENT_RENDERER_MOJO_BLINK_SERVICE_REGISTRY_IMPL_H_ |
| OLD | NEW |