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 #include "ppapi/cpp/url_loader.h" | 5 #include "ppapi/cpp/url_loader.h" |
6 | 6 |
7 #include "ppapi/c/ppb_url_loader.h" | 7 #include "ppapi/c/ppb_url_loader.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/cpp/common.h" | 9 #include "ppapi/cpp/common.h" |
10 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 URLResponseInfo URLLoader::GetResponseInfo() const { | 83 URLResponseInfo URLLoader::GetResponseInfo() const { |
84 if (!has_interface<PPB_URLLoader>()) | 84 if (!has_interface<PPB_URLLoader>()) |
85 return URLResponseInfo(); | 85 return URLResponseInfo(); |
86 return URLResponseInfo(URLResponseInfo::PassRef(), | 86 return URLResponseInfo(URLResponseInfo::PassRef(), |
87 get_interface<PPB_URLLoader>()->GetResponseInfo( | 87 get_interface<PPB_URLLoader>()->GetResponseInfo( |
88 pp_resource())); | 88 pp_resource())); |
89 } | 89 } |
90 | 90 |
91 int32_t URLLoader::ReadResponseBody(char* buffer, | 91 int32_t URLLoader::ReadResponseBody(void* buffer, |
92 int32_t bytes_to_read, | 92 int32_t bytes_to_read, |
93 const CompletionCallback& cc) { | 93 const CompletionCallback& cc) { |
94 if (!has_interface<PPB_URLLoader>()) | 94 if (!has_interface<PPB_URLLoader>()) |
95 return PP_ERROR_NOINTERFACE; | 95 return PP_ERROR_NOINTERFACE; |
96 return get_interface<PPB_URLLoader>()->ReadResponseBody( | 96 return get_interface<PPB_URLLoader>()->ReadResponseBody( |
97 pp_resource(), buffer, bytes_to_read, cc.pp_completion_callback()); | 97 pp_resource(), buffer, bytes_to_read, cc.pp_completion_callback()); |
98 } | 98 } |
99 | 99 |
100 int32_t URLLoader::FinishStreamingToFile(const CompletionCallback& cc) { | 100 int32_t URLLoader::FinishStreamingToFile(const CompletionCallback& cc) { |
101 if (!has_interface<PPB_URLLoader>()) | 101 if (!has_interface<PPB_URLLoader>()) |
102 return PP_ERROR_NOINTERFACE; | 102 return PP_ERROR_NOINTERFACE; |
103 return get_interface<PPB_URLLoader>()->FinishStreamingToFile( | 103 return get_interface<PPB_URLLoader>()->FinishStreamingToFile( |
104 pp_resource(), cc.pp_completion_callback()); | 104 pp_resource(), cc.pp_completion_callback()); |
105 } | 105 } |
106 | 106 |
107 void URLLoader::Close() { | 107 void URLLoader::Close() { |
108 if (!has_interface<PPB_URLLoader>()) | 108 if (!has_interface<PPB_URLLoader>()) |
109 return; | 109 return; |
110 get_interface<PPB_URLLoader>()->Close(pp_resource()); | 110 get_interface<PPB_URLLoader>()->Close(pp_resource()); |
111 } | 111 } |
112 | 112 |
113 } // namespace pp | 113 } // namespace pp |
OLD | NEW |