OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ppapi/proxy/url_response_info_resource.h" | 5 #include "ppapi/proxy/url_response_info_resource.h" |
6 | 6 |
7 #include "ppapi/proxy/ppb_file_ref_proxy.h" | 7 #include "ppapi/proxy/file_ref_resource.h" |
8 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
11 | 11 |
12 namespace ppapi { | 12 namespace ppapi { |
13 namespace proxy { | 13 namespace proxy { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 bool IsRedirect(int32_t status) { | 17 bool IsRedirect(int32_t status) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 case PP_URLRESPONSEPROPERTY_STATUSLINE: | 55 case PP_URLRESPONSEPROPERTY_STATUSLINE: |
56 return StringVar::StringToPPVar(data_.status_text); | 56 return StringVar::StringToPPVar(data_.status_text); |
57 case PP_URLRESPONSEPROPERTY_HEADERS: | 57 case PP_URLRESPONSEPROPERTY_HEADERS: |
58 return StringVar::StringToPPVar(data_.headers); | 58 return StringVar::StringToPPVar(data_.headers); |
59 } | 59 } |
60 // The default is to return an undefined PP_Var. | 60 // The default is to return an undefined PP_Var. |
61 return PP_MakeUndefined(); | 61 return PP_MakeUndefined(); |
62 } | 62 } |
63 | 63 |
64 PP_Resource URLResponseInfoResource::GetBodyAsFileRef() { | 64 PP_Resource URLResponseInfoResource::GetBodyAsFileRef() { |
65 if (!body_as_file_ref_.get()) | 65 if (!body_as_file_ref_.get()) { |
66 return 0; | 66 body_as_file_ref_ = FileRefResource::CreateFileRef( |
yzshen1
2013/08/08 23:16:21
What if the response is not streamed to a file?
teravest
2013/08/09 02:00:08
I don't know what I was thinking here. Changed to
| |
67 connection(), | |
68 pp_instance(), | |
69 data_.body_as_file_ref); | |
70 } | |
67 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource( | 71 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource( |
68 body_as_file_ref_.get()); | 72 body_as_file_ref_.get()); |
69 return body_as_file_ref_.get(); | 73 return body_as_file_ref_.get(); |
70 } | 74 } |
71 | 75 |
72 } // namespace proxy | 76 } // namespace proxy |
73 } // namespace ppapi | 77 } // namespace ppapi |
OLD | NEW |