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