| 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_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ |
| 6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ | 6 #define CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
| 15 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 16 #include "services/shell/public/cpp/interface_provider.h" | 16 #include "services/shell/public/cpp/interface_provider.h" |
| 17 #include "services/shell/public/cpp/interface_registry.h" | 17 #include "services/shell/public/cpp/interface_registry.h" |
| 18 #include "services/shell/public/interfaces/connector.mojom.h" | 18 #include "services/shell/public/interfaces/connector.mojom.h" |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 21 #include "content/public/browser/android/service_registry_android.h" | 21 #include "content/public/browser/android/interface_registry_android.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace shell { | 24 namespace shell { |
| 25 class Connection; | 25 class Connection; |
| 26 class Connector; | 26 class Connector; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 // Helper class to establish a connection between the shell and a single child | 31 // Helper class to establish a connection between the shell and a single child |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 // |switches::kPrimordialPipeToken| in order for the child to initialize its | 56 // |switches::kPrimordialPipeToken| in order for the child to initialize its |
| 57 // end of the shell connection pipe. | 57 // end of the shell connection pipe. |
| 58 std::string service_token() const { return service_token_; } | 58 std::string service_token() const { return service_token_; } |
| 59 | 59 |
| 60 // Sets the child connection's process handle. This should be called as soon | 60 // Sets the child connection's process handle. This should be called as soon |
| 61 // as the process has been launched, and the connection will not be fully | 61 // as the process has been launched, and the connection will not be fully |
| 62 // functional until this is called. | 62 // functional until this is called. |
| 63 void SetProcessHandle(base::ProcessHandle handle); | 63 void SetProcessHandle(base::ProcessHandle handle); |
| 64 | 64 |
| 65 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
| 66 ServiceRegistryAndroid* service_registry_android() { | 66 InterfaceRegistryAndroid* interface_registry_android() { |
| 67 return service_registry_android_.get(); | 67 return interface_registry_android_.get(); |
| 68 } | 68 } |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 class IOThreadContext; | 72 class IOThreadContext; |
| 73 | 73 |
| 74 void GetInterface(const mojo::String& interface_name, | 74 void GetInterface(const mojo::String& interface_name, |
| 75 mojo::ScopedMessagePipeHandle request_handle); | 75 mojo::ScopedMessagePipeHandle request_handle); |
| 76 | 76 |
| 77 scoped_refptr<IOThreadContext> context_; | 77 scoped_refptr<IOThreadContext> context_; |
| 78 | 78 |
| 79 const std::string service_token_; | 79 const std::string service_token_; |
| 80 | 80 |
| 81 shell::InterfaceRegistry interface_registry_; | 81 shell::InterfaceRegistry interface_registry_; |
| 82 shell::InterfaceProvider remote_interfaces_; | 82 shell::InterfaceProvider remote_interfaces_; |
| 83 | 83 |
| 84 #if defined(OS_ANDROID) | 84 #if defined(OS_ANDROID) |
| 85 std::unique_ptr<ServiceRegistryAndroid> service_registry_android_; | 85 std::unique_ptr<InterfaceRegistryAndroid> interface_registry_android_; |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 base::WeakPtrFactory<MojoChildConnection> weak_factory_; | 88 base::WeakPtrFactory<MojoChildConnection> weak_factory_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection); | 90 DISALLOW_COPY_AND_ASSIGN(MojoChildConnection); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace content | 93 } // namespace content |
| 94 | 94 |
| 95 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ | 95 #endif // CONTENT_BROWSER_MOJO_MOJO_CHILD_CONNECTION_H_ |
| OLD | NEW |