| 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_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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 // MojoShellContext hosts the browser's ApplicationManager, coordinating | 29 // MojoShellContext hosts the browser's ApplicationManager, coordinating |
| 30 // app registration and interconnection. | 30 // app registration and interconnection. |
| 31 class CONTENT_EXPORT MojoShellContext { | 31 class CONTENT_EXPORT MojoShellContext { |
| 32 public: | 32 public: |
| 33 using StaticApplicationMap = | 33 using StaticApplicationMap = |
| 34 std::map<std::string, | 34 std::map<std::string, |
| 35 base::Callback<std::unique_ptr<mojo::ShellClient>()>>; | 35 base::Callback<std::unique_ptr<shell::ShellClient>()>>; |
| 36 | 36 |
| 37 MojoShellContext(); | 37 MojoShellContext(); |
| 38 ~MojoShellContext(); | 38 ~MojoShellContext(); |
| 39 | 39 |
| 40 // Connects an application at |name| and gets a handle to its exposed | 40 // Connects an application at |name| and gets a handle to its exposed |
| 41 // services. This is only intended for use in browser code that's not part of | 41 // services. This is only intended for use in browser code that's not part of |
| 42 // some Mojo application. May be called from any thread. |requestor_name| is | 42 // some Mojo application. May be called from any thread. |requestor_name| is |
| 43 // given to the target application as the requestor's name upon connection. | 43 // given to the target application as the requestor's name upon connection. |
| 44 static void ConnectToApplication( | 44 static void ConnectToApplication( |
| 45 const std::string& user_id, | 45 const std::string& user_id, |
| 46 const std::string& name, | 46 const std::string& name, |
| 47 const std::string& requestor_name, | 47 const std::string& requestor_name, |
| 48 mojo::shell::mojom::InterfaceProviderRequest request, | 48 shell::mojom::InterfaceProviderRequest request, |
| 49 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 49 shell::mojom::InterfaceProviderPtr exposed_services, |
| 50 const mojo::shell::mojom::Connector::ConnectCallback& callback); | 50 const shell::mojom::Connector::ConnectCallback& callback); |
| 51 | 51 |
| 52 static void SetApplicationsForTest(const StaticApplicationMap* apps); | 52 static void SetApplicationsForTest(const StaticApplicationMap* apps); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 class BuiltinManifestProvider; | 55 class BuiltinManifestProvider; |
| 56 class Proxy; | 56 class Proxy; |
| 57 friend class Proxy; | 57 friend class Proxy; |
| 58 | 58 |
| 59 void ConnectToApplicationOnOwnThread( | 59 void ConnectToApplicationOnOwnThread( |
| 60 const std::string& user_id, | 60 const std::string& user_id, |
| 61 const std::string& name, | 61 const std::string& name, |
| 62 const std::string& requestor_name, | 62 const std::string& requestor_name, |
| 63 mojo::shell::mojom::InterfaceProviderRequest request, | 63 shell::mojom::InterfaceProviderRequest request, |
| 64 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 64 shell::mojom::InterfaceProviderPtr exposed_services, |
| 65 const mojo::shell::mojom::Connector::ConnectCallback& callback); | 65 const shell::mojom::Connector::ConnectCallback& callback); |
| 66 | 66 |
| 67 static base::LazyInstance<std::unique_ptr<Proxy>> proxy_; | 67 static base::LazyInstance<std::unique_ptr<Proxy>> proxy_; |
| 68 | 68 |
| 69 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; | 69 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; |
| 70 std::unique_ptr<catalog::Factory> catalog_; | 70 std::unique_ptr<catalog::Factory> catalog_; |
| 71 std::unique_ptr<mojo::shell::Shell> shell_; | 71 std::unique_ptr<shell::Shell> shell_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); | 73 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ | 78 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ |
| OLD | NEW |