| 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 MojoShellContext(); | 34 MojoShellContext(); |
| 35 ~MojoShellContext() override; | 35 ~MojoShellContext() override; |
| 36 | 36 |
| 37 // Connects an application at |url| and gets a handle to its exposed services. | 37 // Connects an application at |url| and gets a handle to its exposed services. |
| 38 // This is only intended for use in browser code that's not part of some Mojo | 38 // This is only intended for use in browser code that's not part of some Mojo |
| 39 // application. May be called from any thread. |requestor_url| is given to | 39 // application. May be called from any thread. |requestor_url| is given to |
| 40 // the target application as the requestor's URL upon connection. | 40 // the target application as the requestor's URL upon connection. |
| 41 static void ConnectToApplication( | 41 static void ConnectToApplication( |
| 42 const GURL& url, | 42 const GURL& url, |
| 43 const GURL& requestor_url, | 43 const GURL& requestor_url, |
| 44 mojo::InterfaceRequest<mojo::ServiceProvider> request); | 44 mojo::InterfaceRequest<mojo::ServiceProvider> request, |
| 45 mojo::ServiceProviderPtr exposed_services); |
| 45 | 46 |
| 46 static void SetApplicationsForTest(const StaticApplicationMap* apps); | 47 static void SetApplicationsForTest(const StaticApplicationMap* apps); |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 class Proxy; | 50 class Proxy; |
| 50 friend class Proxy; | 51 friend class Proxy; |
| 51 | 52 |
| 52 void ConnectToApplicationOnOwnThread( | 53 void ConnectToApplicationOnOwnThread( |
| 53 const GURL& url, | 54 const GURL& url, |
| 54 const GURL& requestor_url, | 55 const GURL& requestor_url, |
| 55 mojo::InterfaceRequest<mojo::ServiceProvider> request); | 56 mojo::InterfaceRequest<mojo::ServiceProvider> request, |
| 57 mojo::ServiceProviderPtr exposed_services); |
| 56 | 58 |
| 57 // mojo::shell::ApplicationManager::Delegate: | 59 // mojo::shell::ApplicationManager::Delegate: |
| 58 GURL ResolveMappings(const GURL& url) override; | 60 GURL ResolveMappings(const GURL& url) override; |
| 59 GURL ResolveMojoURL(const GURL& url) override; | 61 GURL ResolveMojoURL(const GURL& url) override; |
| 60 bool CreateFetcher( | 62 bool CreateFetcher( |
| 61 const GURL& url, | 63 const GURL& url, |
| 62 const mojo::shell::Fetcher::FetchCallback& loader_callback) override; | 64 const mojo::shell::Fetcher::FetchCallback& loader_callback) override; |
| 63 | 65 |
| 64 static base::LazyInstance<scoped_ptr<Proxy>> proxy_; | 66 static base::LazyInstance<scoped_ptr<Proxy>> proxy_; |
| 65 | 67 |
| 66 scoped_ptr<mojo::shell::ApplicationManager> application_manager_; | 68 scoped_ptr<mojo::shell::ApplicationManager> application_manager_; |
| 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 |