Index: tonic/dart_library_provider_network.h |
diff --git a/tonic/dart_library_provider_network.h b/tonic/dart_library_provider_network.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2939f92356a763fa62c4b4e418fcdf3ce7ea15a4 |
--- /dev/null |
+++ b/tonic/dart_library_provider_network.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef TONIC_DART_LIBRARY_PROVIDER_NETWORK_H_ |
+#define TONIC_DART_LIBRARY_PROVIDER_NETWORK_H_ |
+ |
+#include <unordered_set> |
+ |
+#include "mojo/services/network/public/interfaces/network_service.mojom.h" |
+#include "tonic/dart_library_provider.h" |
+ |
+namespace tonic { |
+ |
+class DartLibraryProviderNetwork : public DartLibraryProvider { |
+ public: |
+ explicit DartLibraryProviderNetwork(mojo::NetworkService* network_service); |
+ ~DartLibraryProviderNetwork() override; |
+ |
+ mojo::NetworkService* network_service() const { return network_service_; } |
+ |
+ protected: |
+ // |DartLibraryProvider| implementation: |
+ void GetLibraryAsStream(const std::string& name, |
+ DataPipeConsumerCallback callback) override; |
+ Dart_Handle CanonicalizeURL(Dart_Handle library, Dart_Handle url) override; |
+ |
+ private: |
+ class Job; |
+ |
+ mojo::NetworkService* network_service_; |
+ std::unordered_set<std::unique_ptr<Job>> jobs_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DartLibraryProviderNetwork); |
+}; |
+ |
+} // namespace tonic |
+ |
+#endif // TONIC_DART_LIBRARY_PROVIDER_NETWORK_H_ |