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 { |
(...skipping 11 matching lines...) Expand all Loading... |
22 // this object is created in PreMainMessageLoopRun(), so the BrowserMainParts | 22 // this object is created in PreMainMessageLoopRun(), so the BrowserMainParts |
23 // impl can access this in its implementation of that same method. | 23 // impl can access this in its implementation of that same method. |
24 class CONTENT_EXPORT MojoShellConnection { | 24 class CONTENT_EXPORT MojoShellConnection { |
25 public: | 25 public: |
26 // Override to add additional services to inbound connections. | 26 // Override to add additional services to inbound connections. |
27 class Listener { | 27 class Listener { |
28 public: | 28 public: |
29 virtual bool ConfigureIncomingConnection( | 29 virtual bool ConfigureIncomingConnection( |
30 mojo::ApplicationConnection* connection) = 0; | 30 mojo::ApplicationConnection* connection) = 0; |
31 | 31 |
| 32 virtual void OnDestroy() {} |
| 33 |
32 protected: | 34 protected: |
33 virtual ~Listener() {} | 35 virtual ~Listener() {} |
34 }; | 36 }; |
35 | 37 |
36 // Will return null if no connection has been established (either because it | 38 // Will return null if no connection has been established (either because it |
37 // hasn't happened yet or the application was not spawned from the external | 39 // hasn't happened yet or the application was not spawned from the external |
38 // Mojo shell. | 40 // Mojo shell. |
39 static MojoShellConnection* Get(); | 41 static MojoShellConnection* Get(); |
40 | 42 |
41 // Destroys the connection. Must be called on the thread the connection was | 43 // Destroys the connection. Must be called on the thread the connection was |
42 // created on. | 44 // created on. |
43 static void Destroy(); | 45 static void Destroy(); |
44 | 46 |
45 // Returns an Initialized() ApplicationImpl. | 47 // Returns an Initialized() ApplicationImpl. |
46 virtual mojo::ApplicationImpl* GetApplication() = 0; | 48 virtual mojo::ApplicationImpl* GetApplication() = 0; |
47 | 49 |
48 // [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 |
49 // ApplicationImpl exposes services to inbound connections. | 51 // ApplicationImpl exposes services to inbound connections. |
50 virtual void AddListener(Listener* listener) = 0; | 52 virtual void AddListener(Listener* listener) = 0; |
51 virtual void RemoveListener(Listener* listener) = 0; | 53 virtual void RemoveListener(Listener* listener) = 0; |
52 | 54 |
53 protected: | 55 protected: |
54 virtual ~MojoShellConnection(); | 56 virtual ~MojoShellConnection(); |
55 }; | 57 }; |
56 | 58 |
57 } // namespace content | 59 } // namespace content |
58 | 60 |
59 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 61 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
OLD | NEW |