OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_MOJO_SHELL_CONTEXT_IMPL_H_ |
| 6 #define CONTENT_BROWSER_MOJO_SHELL_CONTEXT_IMPL_H_ |
| 7 |
| 8 #include "base/lazy_instance.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/public/browser/mojo_shell_context.h" |
| 13 #include "content/public/common/application_registry.h" |
| 14 #include "mojo/shell/application_manager.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class MojoShellContextImpl : public MojoShellContext, |
| 19 public ApplicationRegistry, |
| 20 public mojo::shell::ApplicationManager::Delegate { |
| 21 public: |
| 22 MojoShellContextImpl(); |
| 23 ~MojoShellContextImpl() override; |
| 24 |
| 25 // Connects an application at |url| and gets a handle to its exposed services. |
| 26 // This is only intended for use in browser code that's not part of some Mojo |
| 27 // application. May be called from any thread. |
| 28 static void ConnectToApplication( |
| 29 const GURL& url, |
| 30 mojo::InterfaceRequest<mojo::ServiceProvider> request); |
| 31 |
| 32 private: |
| 33 class Proxy; |
| 34 friend class Proxy; |
| 35 |
| 36 // ApplicationRegistry: |
| 37 void RegisterStaticAppForURL(const GURL& url, |
| 38 const StaticAppFactory& factory) override; |
| 39 |
| 40 void ConnectToApplicationOnOwnThread( |
| 41 const GURL& url, |
| 42 mojo::InterfaceRequest<mojo::ServiceProvider> request); |
| 43 |
| 44 // mojo::shell::ApplicationManager::Delegate: |
| 45 GURL ResolveMappings(const GURL& url) override; |
| 46 GURL ResolveMojoURL(const GURL& url) override; |
| 47 bool CreateFetcher( |
| 48 const GURL& url, |
| 49 const mojo::shell::Fetcher::FetchCallback& loader_callback) override; |
| 50 |
| 51 static base::LazyInstance<Proxy> proxy_; |
| 52 |
| 53 scoped_ptr<mojo::shell::ApplicationManager> application_manager_; |
| 54 |
| 55 base::WeakPtrFactory<MojoShellContextImpl> weak_factory_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(MojoShellContextImpl); |
| 58 }; |
| 59 |
| 60 } // namespace content |
| 61 |
| 62 #endif // CONTENT_BROWSER_MOJO_SHELL_CONTEXT_IMPL_H_ |
OLD | NEW |