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