| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium 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 PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ | |
| 6 #define PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/c/dev/ppb_url_response_info_dev.h" | |
| 9 #include "ppapi/cpp/resource.h" | |
| 10 #include "ppapi/cpp/var.h" | |
| 11 | |
| 12 namespace pp { | |
| 13 | |
| 14 class FileRef_Dev; | |
| 15 | |
| 16 class URLResponseInfo_Dev : public Resource { | |
| 17 public: | |
| 18 // Creates an is_null() URLResponseInfo object. | |
| 19 URLResponseInfo_Dev() {} | |
| 20 | |
| 21 // This constructor is used when we've gotten a PP_Resource as a return value | |
| 22 // that has already been addref'ed for us. | |
| 23 struct PassRef {}; | |
| 24 URLResponseInfo_Dev(PassRef, PP_Resource resource); | |
| 25 | |
| 26 URLResponseInfo_Dev(const URLResponseInfo_Dev& other); | |
| 27 | |
| 28 URLResponseInfo_Dev& operator=(const URLResponseInfo_Dev& other); | |
| 29 void swap(URLResponseInfo_Dev& other); | |
| 30 | |
| 31 // PPB_URLResponseInfo methods: | |
| 32 Var GetProperty(PP_URLResponseProperty_Dev property) const; | |
| 33 FileRef_Dev GetBody() const; | |
| 34 | |
| 35 // Convenient helpers for getting properties: | |
| 36 Var GetURL() const { | |
| 37 return GetProperty(PP_URLRESPONSEPROPERTY_URL); | |
| 38 } | |
| 39 Var GetRedirectURL() const { | |
| 40 return GetProperty(PP_URLRESPONSEPROPERTY_REDIRECTURL); | |
| 41 } | |
| 42 Var GetRedirectMethod() const { | |
| 43 return GetProperty(PP_URLRESPONSEPROPERTY_REDIRECTMETHOD); | |
| 44 } | |
| 45 int32_t GetStatusCode() const { | |
| 46 return GetProperty(PP_URLRESPONSEPROPERTY_STATUSCODE).AsInt(); | |
| 47 } | |
| 48 Var GetStatusLine() const { | |
| 49 return GetProperty(PP_URLRESPONSEPROPERTY_STATUSLINE); | |
| 50 } | |
| 51 Var GetHeaders() const { | |
| 52 return GetProperty(PP_URLRESPONSEPROPERTY_HEADERS); | |
| 53 } | |
| 54 }; | |
| 55 | |
| 56 } // namespace pp | |
| 57 | |
| 58 #endif // PPAPI_CPP_DEV_URL_RESPONSE_INFO_DEV_H_ | |
| OLD | NEW |