summaryrefslogtreecommitdiff
path: root/platform/default/src/mbgl/storage/local_file_source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/default/src/mbgl/storage/local_file_source.cpp')
-rw-r--r--platform/default/src/mbgl/storage/local_file_source.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/platform/default/src/mbgl/storage/local_file_source.cpp b/platform/default/src/mbgl/storage/local_file_source.cpp
index ca2eedc7ba..54f12baf79 100644
--- a/platform/default/src/mbgl/storage/local_file_source.cpp
+++ b/platform/default/src/mbgl/storage/local_file_source.cpp
@@ -1,15 +1,17 @@
-#include <mbgl/storage/local_file_source.hpp>
#include <mbgl/storage/file_source_request.hpp>
#include <mbgl/storage/local_file_request.hpp>
+#include <mbgl/storage/local_file_source.hpp>
+#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
+#include <mbgl/util/constants.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/thread.hpp>
#include <mbgl/util/url.hpp>
namespace {
-
-const std::string fileProtocol = "file://";
-
+bool acceptsURL(const std::string& url) {
+ return 0 == url.rfind(mbgl::util::FILE_PROTOCOL, 0);
+}
} // namespace
namespace mbgl {
@@ -28,7 +30,7 @@ public:
}
// Cut off the protocol and prefix with path.
- const auto path = mbgl::util::percentDecode(url.substr(fileProtocol.size()));
+ const auto path = mbgl::util::percentDecode(url.substr(std::char_traits<char>::length(util::FILE_PROTOCOL)));
requestLocalFile(path, std::move(req));
}
};
@@ -47,8 +49,16 @@ std::unique_ptr<AsyncRequest> LocalFileSource::request(const Resource& resource,
return std::move(req);
}
-bool LocalFileSource::acceptsURL(const std::string& url) {
- return 0 == url.rfind(fileProtocol, 0);
+bool LocalFileSource::canRequest(const Resource& resource) const {
+ return acceptsURL(resource.url);
+}
+
+void LocalFileSource::pause() {
+ impl->pause();
+}
+
+void LocalFileSource::resume() {
+ impl->resume();
}
} // namespace mbgl