| 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 COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ | 5 #ifndef COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ |
| 6 #define COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ | 6 #define COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/clipboard/public/interfaces/clipboard.mojom.h" |
| 9 #include "mojo/common/weak_binding_set.h" | 10 #include "mojo/common/weak_binding_set.h" |
| 10 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.
h" | 11 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.
h" |
| 11 #include "third_party/mojo/src/mojo/public/cpp/application/interface_factory_imp
l.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/application/interface_factory_imp
l.h" |
| 12 #include "third_party/mojo/src/mojo/public/interfaces/application/service_provid
er.mojom.h" | 13 #include "third_party/mojo_services/src/content_handler/public/interfaces/conten
t_handler.mojom.h" |
| 13 | 14 |
| 14 namespace core_services { | 15 namespace core_services { |
| 15 | 16 |
| 16 // The CoreServices application is a singleton ServiceProvider. There is one | 17 // The CoreServices application is a singleton ServiceProvider. There is one |
| 17 // instance of the CoreServices ServiceProvider. | 18 // instance of the CoreServices ServiceProvider. |
| 18 class CoreServicesApplicationDelegate | 19 class CoreServicesApplicationDelegate |
| 19 : public mojo::ApplicationDelegate, | 20 : public mojo::ApplicationDelegate, |
| 20 public mojo::InterfaceFactory<mojo::ServiceProvider>, | 21 public mojo::InterfaceFactory<mojo::ContentHandler>, |
| 21 public mojo::ServiceProvider { | 22 public mojo::ContentHandler { |
| 22 public: | 23 public: |
| 23 CoreServicesApplicationDelegate(); | 24 CoreServicesApplicationDelegate(); |
| 24 ~CoreServicesApplicationDelegate() override; | 25 ~CoreServicesApplicationDelegate() override; |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 // Overridden from mojo::ApplicationDelegate: | 28 // Overridden from mojo::ApplicationDelegate: |
| 28 bool ConfigureIncomingConnection( | 29 bool ConfigureIncomingConnection( |
| 29 mojo::ApplicationConnection* connection) override; | 30 mojo::ApplicationConnection* connection) override; |
| 30 | 31 |
| 31 // Overridden from mojo::InterfaceFactory<ServiceProvider>: | 32 // Overridden from mojo::InterfaceFactory<mojo::ContentHandler>: |
| 32 void Create(mojo::ApplicationConnection* connection, | 33 void Create(mojo::ApplicationConnection* connection, |
| 33 mojo::InterfaceRequest<ServiceProvider> request) override; | 34 mojo::InterfaceRequest<mojo::ContentHandler> request) override; |
| 34 | 35 |
| 35 // Overridden from ServiceProvider: | 36 // Overridden from mojo::ContentHandler: |
| 36 void ConnectToService(const mojo::String& service_name, | 37 void StartApplication( |
| 37 mojo::ScopedMessagePipeHandle client_handle) override; | 38 mojo::InterfaceRequest<mojo::Application> request, |
| 39 mojo::URLResponsePtr response) override; |
| 38 | 40 |
| 39 // Bindings for all of our connections. | 41 // Bindings for all of our connections. |
| 40 mojo::WeakBindingSet<ServiceProvider> provider_bindings_; | 42 mojo::WeakBindingSet<ContentHandler> handler_bindings_; |
| 43 |
| 44 scoped_ptr<mojo::ApplicationImpl> clipboard_application_; |
| 41 | 45 |
| 42 DISALLOW_COPY_AND_ASSIGN(CoreServicesApplicationDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(CoreServicesApplicationDelegate); |
| 43 }; | 47 }; |
| 44 | 48 |
| 45 } // namespace core_services | 49 } // namespace core_services |
| 46 | 50 |
| 47 #endif // COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ | 51 #endif // COMPONENTS_CORE_SERVICES_APPLICATION_DELEGATE_H_ |
| OLD | NEW |