[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 1 | // Copyright (c) 2012 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_PROXY_URL_RESPONSE_INFO_RESOURCE_H_ |
| 6 | #define PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_ |
| 7 | |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 8 | #include "base/compiler_specific.h" |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 10 | #include "ppapi/proxy/plugin_resource.h" |
| 11 | #include "ppapi/proxy/ppapi_proxy_export.h" |
| 12 | #include "ppapi/shared_impl/scoped_pp_resource.h" |
| 13 | #include "ppapi/shared_impl/url_response_info_data.h" |
| 14 | #include "ppapi/thunk/ppb_url_response_info_api.h" |
| 15 | |
| 16 | namespace ppapi { |
| 17 | namespace proxy { |
| 18 | |
| 19 | class PPAPI_PROXY_EXPORT URLResponseInfoResource |
| 20 | : public PluginResource, |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame^] | 21 | public thunk::PPB_URLResponseInfo_API { |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 22 | public: |
| 23 | // The file_ref_resource should be the body_as_file_ref host resource in the |
| 24 | // |data| converted to a resource valid in the current process (if we're |
| 25 | // downloading to a file; it will be 0 if we're not). A reference |
| 26 | // is passed from the caller and is taken over by this object. |
| 27 | URLResponseInfoResource(Connection connection, |
| 28 | PP_Instance instance, |
| 29 | const URLResponseInfoData& data, |
| 30 | PP_Resource file_ref_resource); |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 31 | ~URLResponseInfoResource() override; |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 32 | |
| 33 | // Resource override. |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 34 | PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() override; |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 35 | |
| 36 | // PPB_URLResponseInfo_API implementation. |
nick | e478443 | 2015-04-23 14:01:48 | [diff] [blame] | 37 | PP_Var GetProperty(PP_URLResponseProperty property) override; |
| 38 | PP_Resource GetBodyAsFileRef() override; |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 39 | |
[email protected] | 47cb253f | 2013-05-16 01:50:40 | [diff] [blame] | 40 | const URLResponseInfoData& data() const { return data_; } |
| 41 | |
[email protected] | 844fecb | 2012-11-16 20:11:06 | [diff] [blame] | 42 | private: |
| 43 | URLResponseInfoData data_; |
| 44 | |
| 45 | // Non-zero when the load is being streamed to a file. |
| 46 | ScopedPPResource body_as_file_ref_; |
| 47 | |
| 48 | DISALLOW_COPY_AND_ASSIGN(URLResponseInfoResource); |
| 49 | }; |
| 50 | |
| 51 | } // namespace proxy |
| 52 | } // namespace ppapi |
| 53 | |
| 54 | #endif // PPAPI_PROXY_URL_RESPONSE_INFO_RESOURCE_H_ |