OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can | |
4 * be found in the LICENSE file. | |
5 */ | |
6 | |
7 #ifndef NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_RESPONSE_INFO_H_ | |
8 #define NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_RESPONSE_INFO_H_ | |
9 | |
10 #include <string> | |
11 | |
12 #include "native_client/src/include/nacl_macros.h" | |
13 #include "native_client/tests/fake_browser_ppapi/fake_resource.h" | |
14 | |
15 #include "ppapi/c/pp_module.h" | |
16 #include "ppapi/c/ppb_url_response_info.h" | |
17 | |
18 namespace fake_browser_ppapi { | |
19 | |
20 // Implements the PPB_URLResponse_Info interface. | |
21 class URLResponseInfo : public Resource { | |
22 public: | |
23 explicit URLResponseInfo(PP_Module module_id) | |
24 : module_id_(module_id), body_as_file_ref_(NULL) {} | |
25 | |
26 URLResponseInfo* AsURLResponseInfo() { return this; } | |
27 | |
28 // Setters. | |
29 void set_url(const std::string& url) { url_ = url; } | |
30 void set_status_code(int32_t status_code) { status_code_ = status_code; } | |
31 void set_body_as_file_ref(FileRef* file_ref) { | |
32 body_as_file_ref_ = file_ref; | |
33 } | |
34 | |
35 // Getters. | |
36 PP_Module module_id() const { return module_id_; } | |
37 const std::string& url() const { return url_; } | |
38 int32_t status_code() { return status_code_; } | |
39 FileRef* body_as_file_ref() const { return body_as_file_ref_; } | |
40 | |
41 // Return an interface pointer usable by PPAPI. | |
42 static const PPB_URLResponseInfo* GetInterface(); | |
43 | |
44 private: | |
45 PP_Module module_id_; | |
46 std::string url_; | |
47 int32_t status_code_; // Http status code. | |
48 FileRef* body_as_file_ref_; | |
49 | |
50 NACL_DISALLOW_COPY_AND_ASSIGN(URLResponseInfo); | |
51 }; | |
52 | |
53 } // namespace fake_browser_ppapi | |
54 | |
55 #endif // NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_RESPONSE_INFO_H_ | |
OLD | NEW |