| 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 MANDOLINE_SERVICES_CORE_SERVICES_CORE_SERVICES_APPLICATION_DELEGATE_H_ | |
| 6 #define MANDOLINE_SERVICES_CORE_SERVICES_CORE_SERVICES_APPLICATION_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_vector.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "components/clipboard/public/interfaces/clipboard.mojom.h" | |
| 12 #include "mojo/common/weak_binding_set.h" | |
| 13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | |
| 14 #include "mojo/shell/public/cpp/interface_factory_impl.h" | |
| 15 #include "mojo/shell/public/cpp/shell_client.h" | |
| 16 #include "mojo/shell/public/interfaces/content_handler.mojom.h" | |
| 17 | |
| 18 namespace core_services { | |
| 19 | |
| 20 class ApplicationThread; | |
| 21 | |
| 22 // The CoreServices application is a singleton ServiceProvider. There is one | |
| 23 // instance of the CoreServices ServiceProvider. | |
| 24 class CoreServicesApplicationDelegate | |
| 25 : public mojo::ShellClient, | |
| 26 public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler>, | |
| 27 public mojo::shell::mojom::ContentHandler { | |
| 28 public: | |
| 29 CoreServicesApplicationDelegate(); | |
| 30 ~CoreServicesApplicationDelegate() override; | |
| 31 | |
| 32 void ApplicationThreadDestroyed(ApplicationThread* thread); | |
| 33 | |
| 34 private: | |
| 35 // Overridden from mojo::ShellClient: | |
| 36 void Initialize(mojo::Shell* shell, const std::string& url, | |
| 37 uint32_t id) override; | |
| 38 bool AcceptConnection(mojo::Connection* connection) override; | |
| 39 void Quit() override; | |
| 40 | |
| 41 // Overridden from mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler>: | |
| 42 void Create( | |
| 43 mojo::Connection* connection, | |
| 44 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> | |
| 45 request) override; | |
| 46 | |
| 47 // Overridden from mojo::shell::mojom::ContentHandler: | |
| 48 void StartApplication( | |
| 49 mojo::InterfaceRequest<mojo::shell::mojom::Application> request, | |
| 50 mojo::URLResponsePtr response, | |
| 51 const mojo::Callback<void()>& destruct_callback) override; | |
| 52 | |
| 53 // Bindings for all of our connections. | |
| 54 mojo::WeakBindingSet<mojo::shell::mojom::ContentHandler> handler_bindings_; | |
| 55 | |
| 56 ScopedVector<ApplicationThread> application_threads_; | |
| 57 mojo::TracingImpl tracing_; | |
| 58 | |
| 59 base::WeakPtrFactory<CoreServicesApplicationDelegate> weak_factory_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(CoreServicesApplicationDelegate); | |
| 62 }; | |
| 63 | |
| 64 } // namespace core_services | |
| 65 | |
| 66 #endif // MANDOLINE_SERVICES_CORE_SERVICES_CORE_SERVICES_APPLICATION_DELEGATE_H
_ | |
| OLD | NEW |