OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 SERVICES_DART_CONTENT_HANDLER_APP_H_ |
| 6 #define SERVICES_DART_CONTENT_HANDLER_APP_H_ |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "mojo/application/content_handler_factory.h" |
| 10 #include "mojo/common/tracing_impl.h" |
| 11 #include "mojo/public/cpp/application/application_delegate.h" |
| 12 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac
he.mojom.h" |
| 13 #include "services/dart/content_handler_app_service_connector.h" |
| 14 #include "services/dart/dart_tracing.h" |
| 15 |
| 16 namespace dart { |
| 17 |
| 18 class DartContentHandlerApp; |
| 19 |
| 20 class DartContentHandler : public mojo::ContentHandlerFactory::ManagedDelegate { |
| 21 public: |
| 22 DartContentHandler(DartContentHandlerApp* app, bool strict); |
| 23 |
| 24 void set_handler_task_runner( |
| 25 scoped_refptr<base::SingleThreadTaskRunner> handler_task_runner); |
| 26 |
| 27 private: |
| 28 // Overridden from ContentHandlerFactory::ManagedDelegate: |
| 29 scoped_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder> |
| 30 CreateApplication( |
| 31 mojo::InterfaceRequest<mojo::Application> application_request, |
| 32 mojo::URLResponsePtr response) override; |
| 33 |
| 34 DartContentHandlerApp* app_; |
| 35 bool strict_; |
| 36 scoped_refptr<base::SingleThreadTaskRunner> handler_task_runner_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(DartContentHandler); |
| 39 }; |
| 40 |
| 41 class DartContentHandlerApp : public mojo::ApplicationDelegate { |
| 42 public: |
| 43 DartContentHandlerApp(); |
| 44 |
| 45 ~DartContentHandlerApp() override; |
| 46 |
| 47 void ExtractApplication(base::FilePath* application_dir, |
| 48 mojo::URLResponsePtr response, |
| 49 const base::Closure& callback); |
| 50 |
| 51 bool run_on_message_loop() const; |
| 52 |
| 53 private: |
| 54 // Overridden from mojo::ApplicationDelegate: |
| 55 void Initialize(mojo::ApplicationImpl* app) override; |
| 56 |
| 57 // Overridden from ApplicationDelegate: |
| 58 bool ConfigureIncomingConnection( |
| 59 mojo::ServiceProviderImpl* service_provider_impl) override; |
| 60 |
| 61 mojo::TracingImpl tracing_; |
| 62 DartContentHandler content_handler_; |
| 63 DartContentHandler strict_content_handler_; |
| 64 mojo::URLResponseDiskCachePtr url_response_disk_cache_; |
| 65 ContentHandlerAppServiceConnector* service_connector_; |
| 66 DartTracingImpl dart_tracing_; |
| 67 bool default_strict_; |
| 68 bool run_on_message_loop_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(DartContentHandlerApp); |
| 71 }; |
| 72 } |
| 73 |
| 74 #endif // SERVICES_DART_CONTENT_HANDLER_APP_H_ |
OLD | NEW |