| 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_LOADER_H_ | |
| 8 #define NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_LOADER_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 #include "ppapi/c/ppb_url_loader.h" | |
| 15 | |
| 16 namespace fake_browser_ppapi { | |
| 17 | |
| 18 // Must be set by main.cc to fake-map a url to a local path. | |
| 19 extern std::string g_nacl_ppapi_url_path; | |
| 20 extern std::string g_nacl_ppapi_local_path; | |
| 21 | |
| 22 // Implements the PPB_URLLoader interface. | |
| 23 class URLLoader : public Resource { | |
| 24 public: | |
| 25 explicit URLLoader(PP_Instance instance_id) | |
| 26 : instance_id_(instance_id), response_(NULL) {} | |
| 27 | |
| 28 URLLoader* AsURLLoader() { return this; } | |
| 29 | |
| 30 URLRequestInfo* request() const { return request_; } | |
| 31 URLResponseInfo* response() const { return response_; } | |
| 32 void set_request(URLRequestInfo* request) { request_ = request; } | |
| 33 void set_response(URLResponseInfo* response) { response_ = response; } | |
| 34 | |
| 35 // Return an interface pointer usable by PPAPI. | |
| 36 static const PPB_URLLoader* GetInterface(); | |
| 37 | |
| 38 private: | |
| 39 PP_Instance instance_id_; | |
| 40 URLRequestInfo* request_; | |
| 41 URLResponseInfo* response_; | |
| 42 | |
| 43 NACL_DISALLOW_COPY_AND_ASSIGN(URLLoader); | |
| 44 }; | |
| 45 | |
| 46 } // namespace fake_browser_ppapi | |
| 47 | |
| 48 #endif // NATIVE_CLIENT_TESTS_FAKE_BROWSER_PPAPI_FAKE_URL_LOADER_H_ | |
| OLD | NEW |