| 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 |
| 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 "base/single_thread_task_runner.h" | |
| 16 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 17 #include "services/shell/public/interfaces/connector.mojom.h" | 16 #include "services/shell/public/interfaces/connector.mojom.h" |
| 18 #include "services/shell/shell.h" | 17 #include "services/shell/shell.h" |
| 19 | 18 |
| 20 namespace catalog { | 19 namespace catalog { |
| 21 class Factory; | 20 class Factory; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace mojo { | 23 namespace mojo { |
| 25 class ShellClient; | 24 class ShellClient; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 | 28 |
| 30 // MojoShellContext hosts the browser's ApplicationManager, coordinating | 29 // MojoShellContext hosts the browser's ApplicationManager, coordinating |
| 31 // app registration and interconnection. | 30 // app registration and interconnection. |
| 32 class CONTENT_EXPORT MojoShellContext { | 31 class CONTENT_EXPORT MojoShellContext { |
| 33 public: | 32 public: |
| 34 using StaticApplicationMap = | 33 using StaticApplicationMap = |
| 35 std::map<std::string, | 34 std::map<std::string, |
| 36 base::Callback<std::unique_ptr<mojo::ShellClient>()>>; | 35 base::Callback<std::unique_ptr<mojo::ShellClient>()>>; |
| 37 | 36 |
| 38 MojoShellContext(scoped_refptr<base::SingleThreadTaskRunner> file_thread, | 37 MojoShellContext(); |
| 39 scoped_refptr<base::SingleThreadTaskRunner> db_thread); | |
| 40 ~MojoShellContext(); | 38 ~MojoShellContext(); |
| 41 | 39 |
| 42 // 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 |
| 43 // 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 |
| 44 // 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 |
| 45 // 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. |
| 46 static void ConnectToApplication( | 44 static void ConnectToApplication( |
| 47 const std::string& user_id, | 45 const std::string& user_id, |
| 48 const std::string& name, | 46 const std::string& name, |
| 49 const std::string& requestor_name, | 47 const std::string& requestor_name, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; | 69 std::unique_ptr<BuiltinManifestProvider> manifest_provider_; |
| 72 std::unique_ptr<catalog::Factory> catalog_; | 70 std::unique_ptr<catalog::Factory> catalog_; |
| 73 std::unique_ptr<mojo::shell::Shell> shell_; | 71 std::unique_ptr<mojo::shell::Shell> shell_; |
| 74 | 72 |
| 75 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); | 73 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); |
| 76 }; | 74 }; |
| 77 | 75 |
| 78 } // namespace content | 76 } // namespace content |
| 79 | 77 |
| 80 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ | 78 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ |
| OLD | NEW |