Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_http.h

Issue 77423002: [NaCl SDK] Add URLLoader fake pepper interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/mount_node_http.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "nacl_io/typed_mount_factory.h" 12 #include "nacl_io/typed_mount_factory.h"
13 13
14 class MountHttpMock;
15
16 namespace nacl_io { 14 namespace nacl_io {
17 15
18 class MountNode;
19
20 std::string NormalizeHeaderKey(const std::string& s); 16 std::string NormalizeHeaderKey(const std::string& s);
21 17
22 class MountHttp : public Mount { 18 class MountHttp : public Mount {
23 public: 19 public:
24 typedef std::map<std::string, ScopedMountNode> NodeMap_t; 20 typedef std::map<std::string, ScopedMountNode> NodeMap_t;
25 21
26 virtual Error Access(const Path& path, int a_mode); 22 virtual Error Access(const Path& path, int a_mode);
27 virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node); 23 virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node);
28 virtual Error Unlink(const Path& path); 24 virtual Error Unlink(const Path& path);
29 virtual Error Mkdir(const Path& path, int permissions); 25 virtual Error Mkdir(const Path& path, int permissions);
30 virtual Error Rmdir(const Path& path); 26 virtual Error Rmdir(const Path& path);
31 virtual Error Remove(const Path& path); 27 virtual Error Remove(const Path& path);
32 virtual Error Rename(const Path& path, const Path& newpath); 28 virtual Error Rename(const Path& path, const Path& newpath);
33 29
34 PP_Resource MakeUrlRequestInfo(const std::string& url, 30 PP_Resource MakeUrlRequestInfo(const std::string& url,
35 const char* method, 31 const char* method,
36 StringMap_t* additional_headers); 32 StringMap_t* additional_headers);
37 33
38 protected: 34 protected:
39 MountHttp(); 35 MountHttp();
40 36
41 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); 37 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi);
42 virtual void Destroy(); 38 virtual void Destroy();
43 Error FindOrCreateDir(const Path& path, ScopedMountNode* out_node); 39 Error FindOrCreateDir(const Path& path, ScopedMountNode* out_node);
44 Error LoadManifest(const std::string& path, char** out_manifest); 40 Error LoadManifest(const std::string& path, char** out_manifest);
45 Error ParseManifest(const char *text); 41 Error ParseManifest(const char *text);
46 42
43 NodeMap_t* GetNodeCacheForTesting() { return &node_cache_; }
44
47 private: 45 private:
48 // Gets the URL to fetch for |path|. 46 // Gets the URL to fetch for |path|.
49 // |path| is relative to the mount point for the HTTP filesystem. 47 // |path| is relative to the mount point for the HTTP filesystem.
50 std::string MakeUrl(const Path& path); 48 std::string MakeUrl(const Path& path);
51 49
52 std::string url_root_; 50 std::string url_root_;
53 StringMap_t headers_; 51 StringMap_t headers_;
54 NodeMap_t node_cache_; 52 NodeMap_t node_cache_;
55 bool allow_cors_; 53 bool allow_cors_;
56 bool allow_credentials_; 54 bool allow_credentials_;
57 bool cache_stat_; 55 bool cache_stat_;
58 bool cache_content_; 56 bool cache_content_;
59 57
60 friend class TypedMountFactory<MountHttp>; 58 friend class TypedMountFactory<MountHttp>;
61 friend class MountNodeHttp; 59 friend class MountNodeHttp;
62 friend class ::MountHttpMock;
63 }; 60 };
64 61
65 } // namespace nacl_io 62 } // namespace nacl_io
66 63
67 #endif // LIBRARIES_NACL_IO_MOUNT_HTTP_H_ 64 #endif // LIBRARIES_NACL_IO_MOUNT_HTTP_H_
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/mount_node_http.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698