| 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 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "mojo/shell/public/interfaces/connector.mojom.h" | 17 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| 18 #include "mojo/shell/shell.h" | 18 #include "mojo/shell/shell.h" |
| 19 | 19 |
| 20 namespace catalog { | 20 namespace catalog { |
| 21 class Factory; | 21 class Factory; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace mojo { | 24 namespace mojo { |
| 25 class ShellClient; | 25 class ShellClient; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 // MojoShellContext hosts the browser's ApplicationManager, coordinating | 30 // MojoShellContext hosts the browser's ApplicationManager, coordinating |
| 31 // app registration and interconnection. | 31 // app registration and interconnection. |
| 32 class CONTENT_EXPORT MojoShellContext { | 32 class CONTENT_EXPORT MojoShellContext { |
| 33 public: | 33 public: |
| 34 using StaticApplicationMap = | 34 using StaticApplicationMap = |
| 35 std::map<std::string, base::Callback<scoped_ptr<mojo::ShellClient>()>>; | 35 std::map<std::string, |
| 36 base::Callback<std::unique_ptr<mojo::ShellClient>()>>; |
| 36 | 37 |
| 37 MojoShellContext(scoped_refptr<base::SingleThreadTaskRunner> file_thread, | 38 MojoShellContext(scoped_refptr<base::SingleThreadTaskRunner> file_thread, |
| 38 scoped_refptr<base::SingleThreadTaskRunner> db_thread); | 39 scoped_refptr<base::SingleThreadTaskRunner> db_thread); |
| 39 ~MojoShellContext(); | 40 ~MojoShellContext(); |
| 40 | 41 |
| 41 // Connects an application at |name| and gets a handle to its exposed | 42 // Connects an application at |name| and gets a handle to its exposed |
| 42 // services. This is only intended for use in browser code that's not part of | 43 // services. This is only intended for use in browser code that's not part of |
| 43 // some Mojo application. May be called from any thread. |requestor_name| is | 44 // some Mojo application. May be called from any thread. |requestor_name| is |
| 44 // given to the target application as the requestor's name upon connection. | 45 // given to the target application as the requestor's name upon connection. |
| 45 static void ConnectToApplication( | 46 static void ConnectToApplication( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 friend class Proxy; | 59 friend class Proxy; |
| 59 | 60 |
| 60 void ConnectToApplicationOnOwnThread( | 61 void ConnectToApplicationOnOwnThread( |
| 61 const std::string& user_id, | 62 const std::string& user_id, |
| 62 const std::string& name, | 63 const std::string& name, |
| 63 const std::string& requestor_name, | 64 const std::string& requestor_name, |
| 64 mojo::shell::mojom::InterfaceProviderRequest request, | 65 mojo::shell::mojom::InterfaceProviderRequest request, |
| 65 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 66 mojo::shell::mojom::InterfaceProviderPtr exposed_services, |
| 66 const mojo::shell::mojom::Connector::ConnectCallback& callback); | 67 const mojo::shell::mojom::Connector::ConnectCallback& callback); |
| 67 | 68 |
| 68 static base::LazyInstance<scoped_ptr<Proxy>> proxy_; | 69 static base::LazyInstance<std::unique_ptr<Proxy>> proxy_; |
| 69 | 70 |
| 70 scoped_ptr<BuiltinManifestProvider> manifest_provider_; | 71 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; |
| 71 scoped_ptr<catalog::Factory> catalog_; | 72 std::unique_ptr<catalog::Factory> catalog_; |
| 72 scoped_ptr<mojo::shell::Shell> shell_; | 73 std::unique_ptr<mojo::shell::Shell> shell_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); | 75 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace content | 78 } // namespace content |
| 78 | 79 |
| 79 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ | 80 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ |
| OLD | NEW |