1 // Copyright (c) 2012 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.
6 #ifndef LIBRARIES_NACL_IO_MOUNT_HTTP_H_
7 #define LIBRARIES_NACL_IO_MOUNT_HTTP_H_
10 #include "nacl_io/mount.h"
11 #include "nacl_io/pepper_interface.h"
12 #include "nacl_io/typed_mount_factory.h"
20 std::string NormalizeHeaderKey(const std::string& s);
22 class MountHttp : public Mount {
24 typedef std::map<std::string, ScopedMountNode> NodeMap_t;
26 virtual Error Access(const Path& path, int a_mode);
27 virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node);
28 virtual Error Unlink(const Path& path);
29 virtual Error Mkdir(const Path& path, int permissions);
30 virtual Error Rmdir(const Path& path);
31 virtual Error Remove(const Path& path);
33 PP_Resource MakeUrlRequestInfo(const std::string& url,
35 StringMap_t* additional_headers);
40 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi);
41 virtual void Destroy();
42 Error FindOrCreateDir(const Path& path, ScopedMountNode* out_node);
43 Error LoadManifest(const std::string& path, char** out_manifest);
44 Error ParseManifest(const char *text);
47 // Gets the URL to fetch for |path|.
48 // |path| is relative to the mount point for the HTTP filesystem.
49 std::string MakeUrl(const Path& path);
51 std::string url_root_;
53 NodeMap_t node_cache_;
55 bool allow_credentials_;
59 friend class TypedMountFactory<MountHttp>;
60 friend class MountNodeHttp;
61 friend class ::MountHttpMock;
64 } // namespace nacl_io
66 #endif // LIBRARIES_NACL_IO_MOUNT_HTTP_H_