John McCutchan | d695d70 | 2016-03-01 09:42:21 -0800 | [diff] [blame^] | 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 TONIC_DART_LIBRARY_PROVIDER_FILES_H_ |
| 6 | #define TONIC_DART_LIBRARY_PROVIDER_FILES_H_ |
| 7 | |
| 8 | #include "base/files/file_path.h" |
| 9 | #include "tonic/dart_library_provider.h" |
| 10 | |
| 11 | namespace tonic { |
| 12 | |
| 13 | class DartLibraryProviderFiles : public DartLibraryProvider { |
| 14 | public: |
| 15 | explicit DartLibraryProviderFiles(const base::FilePath& package_root); |
| 16 | ~DartLibraryProviderFiles() override; |
| 17 | |
| 18 | protected: |
| 19 | // |DartLibraryProvider| implementation: |
| 20 | void GetLibraryAsStream(const std::string& name, |
| 21 | DataPipeConsumerCallback callback) override; |
| 22 | Dart_Handle CanonicalizeURL(Dart_Handle library, Dart_Handle url) override; |
| 23 | |
| 24 | private: |
| 25 | std::string CanonicalizePackageURL(std::string url); |
| 26 | |
| 27 | base::FilePath package_root_; |
| 28 | |
| 29 | DISALLOW_COPY_AND_ASSIGN(DartLibraryProviderFiles); |
| 30 | }; |
| 31 | |
| 32 | } // namespace tonic |
| 33 | |
| 34 | #endif // TONIC_DART_LIBRARY_PROVIDER_FILES_H_ |