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" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 bool is_external); | 57 bool is_external); |
58 | 58 |
59 virtual shell::Connector* GetConnector() = 0; | 59 virtual shell::Connector* GetConnector() = 0; |
60 | 60 |
61 virtual const shell::Identity& GetIdentity() const = 0; | 61 virtual const shell::Identity& GetIdentity() const = 0; |
62 | 62 |
63 // 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 |
64 // a shell embedded in the browser process (false). | 64 // a shell embedded in the browser process (false). |
65 virtual bool UsingExternalShell() const = 0; | 65 virtual bool UsingExternalShell() const = 0; |
66 | 66 |
67 // Sets a closure that is called when the connection is lost. | 67 // Sets a closure that is called when the connection is lost. Note that |
| 68 // connection may already have been closed, in which case |closure| will be |
| 69 // run immediately before returning from this function. |
68 virtual void SetConnectionLostClosure(const base::Closure& closure) = 0; | 70 virtual void SetConnectionLostClosure(const base::Closure& closure) = 0; |
69 | 71 |
70 // [De]Register an impl of Listener that will be consulted when the wrapped | 72 // [De]Register an impl of Listener that will be consulted when the wrapped |
71 // ShellConnection exposes services to inbound connections. | 73 // ShellConnection exposes services to inbound connections. |
72 // Registered listeners are owned by this MojoShellConnection. If a listener | 74 // Registered listeners are owned by this MojoShellConnection. If a listener |
73 // is removed, then the ownership is transferred back to the caller. | 75 // is removed, then the ownership is transferred back to the caller. |
74 virtual void AddListener(std::unique_ptr<Listener> listener) = 0; | 76 virtual void AddListener(std::unique_ptr<Listener> listener) = 0; |
75 virtual std::unique_ptr<Listener> RemoveListener(Listener* listener) = 0; | 77 virtual std::unique_ptr<Listener> RemoveListener(Listener* listener) = 0; |
76 | 78 |
77 protected: | 79 protected: |
78 virtual ~MojoShellConnection(); | 80 virtual ~MojoShellConnection(); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace content | 83 } // namespace content |
82 | 84 |
83 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 85 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
OLD | NEW |