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 "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 class Connection; | 11 class Connection; |
12 class Shell; | 12 class Connector; |
13 } | 13 } |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 // Encapsulates a connection to a spawning external Mojo shell. | 17 // Encapsulates a connection to a spawning external Mojo shell. |
18 // Access an instance by calling Get(), on the thread the Shell connection is | 18 // Access an instance by calling Get(), on the thread the Shell connection is |
19 // bound. Clients can implement Listener, which allows them to register services | 19 // bound. Clients can implement Listener, which allows them to register services |
20 // to expose to inbound connections. Clients should call this any time after | 20 // to expose to inbound connections. Clients should call this any time after |
21 // the main message loop is created but not yet run (e.g. in the browser process | 21 // the main message loop is created but not yet run (e.g. in the browser process |
22 // this object is created in PreMainMessageLoopRun(), so the BrowserMainParts | 22 // this object is created in PreMainMessageLoopRun(), so the BrowserMainParts |
(...skipping 11 matching lines...) Expand all Loading... |
34 | 34 |
35 // Will return null if no connection has been established (either because it | 35 // Will return null if no connection has been established (either because it |
36 // hasn't happened yet or the application was not spawned from the external | 36 // hasn't happened yet or the application was not spawned from the external |
37 // Mojo shell. | 37 // Mojo shell. |
38 static MojoShellConnection* Get(); | 38 static MojoShellConnection* Get(); |
39 | 39 |
40 // Destroys the connection. Must be called on the thread the connection was | 40 // Destroys the connection. Must be called on the thread the connection was |
41 // created on. | 41 // created on. |
42 static void Destroy(); | 42 static void Destroy(); |
43 | 43 |
44 // Returns an Initialized() Shell. | 44 virtual mojo::Connector* GetConnector() = 0; |
45 virtual mojo::Shell* GetShell() = 0; | |
46 | 45 |
47 // Indicates whether the shell connection is to an external shell (true) or | 46 // Indicates whether the shell connection is to an external shell (true) or |
48 // a shell embedded in the browser process (false). | 47 // a shell embedded in the browser process (false). |
49 virtual bool UsingExternalShell() const = 0; | 48 virtual bool UsingExternalShell() const = 0; |
50 | 49 |
51 // [De]Register an impl of Listener that will be consulted when the wrapped | 50 // [De]Register an impl of Listener that will be consulted when the wrapped |
52 // ShellConnection exposes services to inbound connections. | 51 // ShellConnection exposes services to inbound connections. |
53 // Registered listeners are owned by this MojoShellConnection. | 52 // Registered listeners are owned by this MojoShellConnection. |
54 virtual void AddListener(Listener* listener) = 0; | 53 virtual void AddListener(Listener* listener) = 0; |
55 virtual void RemoveListener(Listener* listener) = 0; | 54 virtual void RemoveListener(Listener* listener) = 0; |
56 | 55 |
57 protected: | 56 protected: |
58 virtual ~MojoShellConnection(); | 57 virtual ~MojoShellConnection(); |
59 }; | 58 }; |
60 | 59 |
61 } // namespace content | 60 } // namespace content |
62 | 61 |
63 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 62 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
OLD | NEW |