| 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 #ifndef CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 6 #define CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "services/shell/public/cpp/identity.h" |
| 12 #include "services/shell/public/interfaces/shell_client.mojom.h" | 13 #include "services/shell/public/interfaces/shell_client.mojom.h" |
| 13 | 14 |
| 14 namespace shell { | 15 namespace shell { |
| 15 class Connection; | 16 class Connection; |
| 16 class Connector; | 17 class Connector; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // Encapsulates a connection to a spawning external Mojo shell. | 22 // Encapsulates a connection to a spawning external Mojo shell. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 50 // created on. | 51 // created on. |
| 51 static void Destroy(); | 52 static void Destroy(); |
| 52 | 53 |
| 53 // Creates the appropriate MojoShellConnection from |request|. See | 54 // Creates the appropriate MojoShellConnection from |request|. See |
| 54 // UsingExternalShell() for details of |is_external|. | 55 // UsingExternalShell() for details of |is_external|. |
| 55 static void Create(shell::mojom::ShellClientRequest request, | 56 static void Create(shell::mojom::ShellClientRequest request, |
| 56 bool is_external); | 57 bool is_external); |
| 57 | 58 |
| 58 virtual shell::Connector* GetConnector() = 0; | 59 virtual shell::Connector* GetConnector() = 0; |
| 59 | 60 |
| 61 virtual const shell::Identity& GetIdentity() const = 0; |
| 62 |
| 60 // Indicates whether the shell connection is to an external shell (true) or | 63 // Indicates whether the shell connection is to an external shell (true) or |
| 61 // a shell embedded in the browser process (false). | 64 // a shell embedded in the browser process (false). |
| 62 virtual bool UsingExternalShell() const = 0; | 65 virtual bool UsingExternalShell() const = 0; |
| 63 | 66 |
| 64 // Sets a closure that is called when the connection is lost. | 67 // Sets a closure that is called when the connection is lost. |
| 65 virtual void SetConnectionLostClosure(const base::Closure& closure) = 0; | 68 virtual void SetConnectionLostClosure(const base::Closure& closure) = 0; |
| 66 | 69 |
| 67 // [De]Register an impl of Listener that will be consulted when the wrapped | 70 // [De]Register an impl of Listener that will be consulted when the wrapped |
| 68 // ShellConnection exposes services to inbound connections. | 71 // ShellConnection exposes services to inbound connections. |
| 69 // Registered listeners are owned by this MojoShellConnection. If a listener | 72 // Registered listeners are owned by this MojoShellConnection. If a listener |
| 70 // is removed, then the ownership is transferred back to the caller. | 73 // is removed, then the ownership is transferred back to the caller. |
| 71 virtual void AddListener(std::unique_ptr<Listener> listener) = 0; | 74 virtual void AddListener(std::unique_ptr<Listener> listener) = 0; |
| 72 virtual std::unique_ptr<Listener> RemoveListener(Listener* listener) = 0; | 75 virtual std::unique_ptr<Listener> RemoveListener(Listener* listener) = 0; |
| 73 | 76 |
| 74 protected: | 77 protected: |
| 75 virtual ~MojoShellConnection(); | 78 virtual ~MojoShellConnection(); |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 } // namespace content | 81 } // namespace content |
| 79 | 82 |
| 80 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 83 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
| OLD | NEW |