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