Chromium Code Reviews| 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 // Implementation of the global Mojo shell context in the browser. | |
|
jam
2015/05/27 16:05:36
it's not clear to a reader what "mojo shell contex
Ken Rockot(use gerrit already)
2015/05/27 19:36:16
Done.
| |
| 19 class MojoShellContextImpl : public MojoShellContext, | |
| 20 public ApplicationRegistry, | |
| 21 public mojo::shell::ApplicationManager::Delegate { | |
| 22 public: | |
| 23 MojoShellContextImpl(); | |
| 24 ~MojoShellContextImpl() override; | |
| 25 | |
| 26 // Connects an application at |url| and gets a handle to its exposed services. | |
| 27 // This is only intended for use in browser code that's not part of some Mojo | |
| 28 // application. May be called from any thread. | |
| 29 static void ConnectToApplication( | |
| 30 const GURL& url, | |
| 31 mojo::InterfaceRequest<mojo::ServiceProvider> request); | |
| 32 | |
| 33 private: | |
| 34 class Proxy; | |
| 35 friend class Proxy; | |
| 36 | |
| 37 // ApplicationRegistry: | |
| 38 void RegisterStaticAppForURL(const GURL& url, | |
| 39 const StaticAppFactory& factory) override; | |
| 40 | |
| 41 void ConnectToApplicationOnOwnThread( | |
| 42 const GURL& url, | |
| 43 mojo::InterfaceRequest<mojo::ServiceProvider> request); | |
| 44 | |
| 45 // mojo::shell::ApplicationManager::Delegate: | |
| 46 GURL ResolveMappings(const GURL& url) override; | |
| 47 GURL ResolveMojoURL(const GURL& url) override; | |
| 48 bool CreateFetcher( | |
| 49 const GURL& url, | |
| 50 const mojo::shell::Fetcher::FetchCallback& loader_callback) override; | |
| 51 | |
| 52 static base::LazyInstance<Proxy> proxy_; | |
| 53 | |
| 54 scoped_ptr<mojo::shell::ApplicationManager> application_manager_; | |
| 55 | |
| 56 base::WeakPtrFactory<MojoShellContextImpl> weak_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(MojoShellContextImpl); | |
| 59 }; | |
| 60 | |
| 61 } // namespace content | |
| 62 | |
| 63 #endif // CONTENT_BROWSER_MOJO_SHELL_CONTEXT_IMPL_H_ | |
| OLD | NEW |