OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_REQUEST_INFO_H_ | |
6 #define NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_REQUEST_INFO_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "native_client/src/include/nacl_macros.h" | |
11 #include "native_client/tests/fake_browser_ppapi/fake_resource.h" | |
12 #include "ppapi/c/ppb_url_request_info.h" | |
13 | |
14 namespace fake_browser_ppapi { | |
15 | |
16 // Implements the PPB_URLRequestInfo interface. | |
17 class URLRequestInfo : public Resource { | |
18 public: | |
19 explicit URLRequestInfo(PP_Instance instance_id) | |
20 : instance_id_(instance_id), stream_to_file_(false) {} | |
21 | |
22 URLRequestInfo* AsURLRequestInfo() { return this; } | |
23 | |
24 // Setters | |
25 void set_url(const std::string& url) { url_ = url; } | |
26 void set_method(const std::string& method) { method_ = method; } | |
27 void set_headers(const std::string& headers) { headers_ = headers; } | |
28 void set_stream_to_file(bool stream_to_file) { | |
29 stream_to_file_ = stream_to_file; | |
30 } | |
31 | |
32 // Getters | |
33 PP_Instance instance_id() const { return instance_id_; } | |
34 const std::string& url() const { return url_; } | |
35 bool stream_to_file() { return stream_to_file_; } | |
36 | |
37 // Return an interface pointer usable by PPAPI. | |
38 static const PPB_URLRequestInfo* GetInterface(); | |
39 | |
40 private: | |
41 PP_Instance instance_id_; | |
42 std::string url_; | |
43 std::string method_; | |
44 std::string headers_; | |
45 bool stream_to_file_; | |
46 | |
47 NACL_DISALLOW_COPY_AND_ASSIGN(URLRequestInfo); | |
48 }; | |
49 | |
50 } // namespace fake_browser_ppapi | |
51 | |
52 #endif // NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_REQUEST_INFO_H_ | |
OLD | NEW |