OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 #ifndef LIBRARIES_NACL_IO_MOUNT_HTTP_H_ | 6 #ifndef LIBRARIES_NACL_IO_MOUNT_HTTP_H_ |
7 #define LIBRARIES_NACL_IO_MOUNT_HTTP_H_ | 7 #define LIBRARIES_NACL_IO_MOUNT_HTTP_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include "nacl_io/mount.h" | 10 #include "nacl_io/mount.h" |
11 #include "nacl_io/pepper_interface.h" | 11 #include "nacl_io/pepper_interface.h" |
12 | 12 |
13 class MountNode; | 13 class MountNode; |
14 class MountNodeDir; | 14 class MountNodeDir; |
15 class MountNodeHttp; | 15 class MountNodeHttp; |
16 class MountHttpMock; | 16 class MountHttpMock; |
17 | 17 |
18 std::string NormalizeHeaderKey(const std::string& s); | 18 std::string NormalizeHeaderKey(const std::string& s); |
19 | 19 |
20 class MountHttp : public Mount { | 20 class MountHttp : public Mount { |
21 public: | 21 public: |
22 typedef std::map<std::string, MountNode*> NodeMap_t; | 22 typedef std::map<std::string, MountNode*> NodeMap_t; |
23 | 23 |
| 24 virtual Error Access(const Path& path, int a_mode); |
24 virtual Error Open(const Path& path, int mode, MountNode** out_node); | 25 virtual Error Open(const Path& path, int mode, MountNode** out_node); |
25 virtual Error Unlink(const Path& path); | 26 virtual Error Unlink(const Path& path); |
26 virtual Error Mkdir(const Path& path, int permissions); | 27 virtual Error Mkdir(const Path& path, int permissions); |
27 virtual Error Rmdir(const Path& path); | 28 virtual Error Rmdir(const Path& path); |
28 virtual Error Remove(const Path& path); | 29 virtual Error Remove(const Path& path); |
29 | 30 |
30 PP_Resource MakeUrlRequestInfo(const std::string& url, | 31 PP_Resource MakeUrlRequestInfo(const std::string& url, |
31 const char* method, | 32 const char* method, |
32 StringMap_t* additional_headers); | 33 StringMap_t* additional_headers); |
33 | 34 |
34 protected: | 35 protected: |
35 MountHttp(); | 36 MountHttp(); |
36 | 37 |
37 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); | 38 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); |
38 virtual void Destroy(); | 39 virtual void Destroy(); |
39 Error FindOrCreateDir(const Path& path, MountNodeDir** out_node); | 40 Error FindOrCreateDir(const Path& path, MountNodeDir** out_node); |
40 Error LoadManifest(const std::string& path, char** out_manifest); | 41 Error LoadManifest(const std::string& path, char** out_manifest); |
41 Error ParseManifest(char *text); | 42 Error ParseManifest(char *text); |
42 | 43 |
43 private: | 44 private: |
| 45 // Gets the URL to fetch for |path|. |
| 46 // |path| is relative to the mount point for the HTTP filesystem. |
| 47 std::string MakeUrl(const Path& path); |
| 48 |
44 std::string url_root_; | 49 std::string url_root_; |
45 StringMap_t headers_; | 50 StringMap_t headers_; |
46 NodeMap_t node_cache_; | 51 NodeMap_t node_cache_; |
47 bool allow_cors_; | 52 bool allow_cors_; |
48 bool allow_credentials_; | 53 bool allow_credentials_; |
49 bool cache_stat_; | 54 bool cache_stat_; |
50 bool cache_content_; | 55 bool cache_content_; |
51 | 56 |
52 friend class Mount; | 57 friend class Mount; |
53 friend class MountNodeHttp; | 58 friend class MountNodeHttp; |
54 friend class MountHttpMock; | 59 friend class MountHttpMock; |
55 }; | 60 }; |
56 | 61 |
57 #endif // LIBRARIES_NACL_IO_MOUNT_HTTP_H_ | 62 #endif // LIBRARIES_NACL_IO_MOUNT_HTTP_H_ |
OLD | NEW |