Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: content/public/common/mojo_shell_connection.h

Issue 1476643002: mustash: Enable connections to mus from the Chrome renderer [take 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment on RenderWidgetWindowTreeClientFactory lifetime Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "mojo/public/cpp/system/message_pipe.h"
9 10
10 namespace mojo { 11 namespace mojo {
11 class ApplicationConnection; 12 class ApplicationConnection;
12 class ApplicationImpl; 13 class ApplicationImpl;
13 } 14 }
14 15
15 namespace content { 16 namespace content {
16 17
17 // Encapsulates a connection to a spawning external Mojo shell. 18 // Encapsulates a connection to a spawning external Mojo shell.
18 // Access an instance by calling Get(), on the thread the Shell connection is 19 // 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 20 // bound. Clients can implement Listener, which allows them to register services
20 // to expose to inbound connections. Clients should call this any time after 21 // 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 22 // 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 23 // this object is created in PreMainMessageLoopRun(), so the BrowserMainParts
23 // impl can access this in its implementation of that same method. 24 // impl can access this in its implementation of that same method.
24 class CONTENT_EXPORT MojoShellConnection { 25 class CONTENT_EXPORT MojoShellConnection {
25 public: 26 public:
26 // Override to add additional services to inbound connections. 27 // Override to add additional services to inbound connections.
27 class Listener { 28 class Listener {
28 public: 29 public:
29 virtual bool ConfigureIncomingConnection( 30 virtual bool ConfigureIncomingConnection(
30 mojo::ApplicationConnection* connection) = 0; 31 mojo::ApplicationConnection* connection) = 0;
31 32
32 protected:
33 virtual ~Listener() {} 33 virtual ~Listener() {}
34 }; 34 };
35 35
36 // Will return null if no connection has been established (either because it 36 // 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 37 // hasn't happened yet or the application was not spawned from the external
38 // Mojo shell. 38 // Mojo shell.
39 static MojoShellConnection* Get(); 39 static MojoShellConnection* Get();
40 40
41 // Destroys the connection. Must be called on the thread the connection was 41 // Destroys the connection. Must be called on the thread the connection was
42 // created on. 42 // created on.
43 static void Destroy(); 43 static void Destroy();
44 44
45 // Blocks the calling thread until calling GetApplication() will return an
46 // Initialized() application with a bound ShellPtr. This call is a no-op
47 // if the connection has already been initialized.
48 virtual void BindToCommandLinePlatformChannel() = 0;
jam 2015/11/25 21:26:15 these are only used by internal content code, so t
49
50 // Same as BindToCommandLinePlatformChannel(), but receives a handle instead
51 // of looking for one on the command line.
52 virtual void BindToMessagePipe(mojo::ScopedMessagePipeHandle handle) = 0;
53
45 // Returns an Initialized() ApplicationImpl. 54 // Returns an Initialized() ApplicationImpl.
46 virtual mojo::ApplicationImpl* GetApplication() = 0; 55 virtual mojo::ApplicationImpl* GetApplication() = 0;
47 56
48 // [De]Register an impl of Listener that will be consulted when the wrapped 57 // [De]Register an impl of Listener that will be consulted when the wrapped
49 // ApplicationImpl exposes services to inbound connections. 58 // ApplicationImpl exposes services to inbound connections.
59 // Registered listeners are owned by this MojoShellConnection.
50 virtual void AddListener(Listener* listener) = 0; 60 virtual void AddListener(Listener* listener) = 0;
51 virtual void RemoveListener(Listener* listener) = 0; 61 virtual void RemoveListener(Listener* listener) = 0;
52 62
53 protected: 63 protected:
54 virtual ~MojoShellConnection(); 64 virtual ~MojoShellConnection();
55 }; 65 };
56 66
57 } // namespace content 67 } // namespace content
58 68
59 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ 69 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_
OLDNEW
« no previous file with comments | « content/common/render_widget_window_tree_client_factory.mojom ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698