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

Side by Side Diff: content/browser/mojo/mojo_shell_context.h

Issue 2112543002: Convert UtilityProcessHost to bootstrap Mojo Channel using the Shell connection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@p9x
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/shell_context.h"
16 #include "services/shell/public/interfaces/connector.mojom.h" 17 #include "services/shell/public/interfaces/connector.mojom.h"
17 #include "services/shell/shell.h" 18 #include "services/shell/shell.h"
18 19
19 namespace catalog { 20 namespace catalog {
20 class Catalog; 21 class Catalog;
21 } 22 }
22 23
23 namespace shell { 24 namespace shell {
24 class ShellClient; 25 class ShellClient;
25 } 26 }
26 27
27 namespace content { 28 namespace content {
28 29
29 // MojoShellContext hosts the browser's ApplicationManager, coordinating 30 // MojoShellContext hosts the browser's ApplicationManager, coordinating
30 // app registration and interconnection. 31 // app registration and interconnection.
31 class CONTENT_EXPORT MojoShellContext { 32 class CONTENT_EXPORT MojoShellContext : public ShellContext {
Ken Rockot(use gerrit already) 2016/06/30 14:50:53 nit: I suppose ShellContextImpl is a much better n
32 public: 33 public:
33 MojoShellContext(); 34 MojoShellContext();
34 ~MojoShellContext(); 35 ~MojoShellContext() override;
35 36
36 // Connects an application at |name| and gets a handle to its exposed 37 // Connects an application at |name| and gets a handle to its exposed
37 // services. This is only intended for use in browser code that's not part of 38 // services. This is only intended for use in browser code that's not part of
38 // some Mojo application. May be called from any thread. |requestor_name| is 39 // some Mojo application. May be called from any thread. |requestor_name| is
39 // given to the target application as the requestor's name upon connection. 40 // given to the target application as the requestor's name upon connection.
40 static void ConnectToApplication( 41 static void ConnectToApplication(
41 const std::string& user_id, 42 const std::string& user_id,
42 const std::string& name, 43 const std::string& name,
43 const std::string& requestor_name, 44 const std::string& requestor_name,
44 shell::mojom::InterfaceProviderRequest request, 45 shell::mojom::InterfaceProviderRequest request,
45 shell::mojom::InterfaceProviderPtr exposed_services, 46 shell::mojom::InterfaceProviderPtr exposed_services,
46 const shell::mojom::Connector::ConnectCallback& callback); 47 const shell::mojom::Connector::ConnectCallback& callback);
47 48
48 // Returns a shell::Connector that can be used on the IO thread.
49 static shell::Connector* GetConnectorForIOThread();
50
51 private: 49 private:
52 class BuiltinManifestProvider; 50 class BuiltinManifestProvider;
53 class Proxy; 51 class Proxy;
54 friend class Proxy; 52 friend class Proxy;
55 53
56 void ConnectToApplicationOnOwnThread( 54 void ConnectToApplicationOnOwnThread(
57 const std::string& user_id, 55 const std::string& user_id,
58 const std::string& name, 56 const std::string& name,
59 const std::string& requestor_name, 57 const std::string& requestor_name,
60 shell::mojom::InterfaceProviderRequest request, 58 shell::mojom::InterfaceProviderRequest request,
61 shell::mojom::InterfaceProviderPtr exposed_services, 59 shell::mojom::InterfaceProviderPtr exposed_services,
62 const shell::mojom::Connector::ConnectCallback& callback); 60 const shell::mojom::Connector::ConnectCallback& callback);
63 61
64 static base::LazyInstance<std::unique_ptr<Proxy>> proxy_; 62 static base::LazyInstance<std::unique_ptr<Proxy>> proxy_;
65 63
66 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; 64 std::unique_ptr<BuiltinManifestProvider> manifest_provider_;
67 std::unique_ptr<catalog::Catalog> catalog_; 65 std::unique_ptr<catalog::Catalog> catalog_;
68 std::unique_ptr<shell::Shell> shell_; 66 std::unique_ptr<shell::Shell> shell_;
69 67
70 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); 68 DISALLOW_COPY_AND_ASSIGN(MojoShellContext);
71 }; 69 };
72 70
73 } // namespace content 71 } // namespace content
74 72
75 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 73 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698