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

Side by Side Diff: content/public/browser/mojo_app_connection.h

Issue 1128453004: Embed a simple Mojo shell in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_
6 #define CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_
7
8 #include "base/macros.h"
9 #include "content/common/content_export.h"
10 #include "third_party/mojo/src/mojo/public/interfaces/application/service_provid er.mojom.h"
11 #include "third_party/mojo/src/mojo/public/interfaces/application/shell.mojom.h"
12 #include "url/gurl.h"
13
14 namespace mojo {
15
16 namespace shell {
17 class ApplicationManager;
18 } // namespace shell
19 } // namespace mojo
20
21 namespace content {
22 class MojoShellContextImpl;
23
24 // Provides a way for browser code to connect to Mojo applications though the
25 // global Mojo shell. These objects may be constructed on any thread.
26 class CONTENT_EXPORT MojoAppConnection {
27 public:
28 // Constructs a new browser shell proxy which will connect to an application
29 // at |application_url| to get remote services.
30 explicit MojoAppConnection(const GURL& application_url);
31 ~MojoAppConnection();
32
33 // Connects to a remote service by type.
34 template <typename Interface>
35 void ConnectToService(mojo::InterfacePtr<Interface>* proxy) {
36 remote_services_->ConnectToService(Interface::Name_,
37 mojo::GetProxy(proxy).PassMessagePipe());
38 }
39
40 private:
41 friend class MojoShellContextImpl;
42
43 // Called by whomever creates the global ApplicationManager. In practice,
44 // that's MojoShellContext. Should be called from whatever thread the
45 // ApplicationManager lives on.
46 static void SetApplicationManager(
47 mojo::shell::ApplicationManager* application_manager);
48
49 mojo::ServiceProviderPtr remote_services_;
50
51 DISALLOW_COPY_AND_ASSIGN(MojoAppConnection);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_PUBLIC_BROWSER_MOJO_APP_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698