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_URL_LOADER_H_ | 5 #ifndef PPAPI_CPP_URL_LOADER_H_ |
6 #define PPAPI_CPP_URL_LOADER_H_ | 6 #define PPAPI_CPP_URL_LOADER_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 #include "ppapi/cpp/resource.h" | 9 #include "ppapi/cpp/resource.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // did_open_(false) { | 27 // did_open_(false) { |
28 // } | 28 // } |
29 // void ProcessURL(const char* url) { | 29 // void ProcessURL(const char* url) { |
30 // CompletionCallback* cc = NewCallback(); | 30 // CompletionCallback* cc = NewCallback(); |
31 // int32_t rv = loader_.Open(MakeRequest(url), cc); | 31 // int32_t rv = loader_.Open(MakeRequest(url), cc); |
32 // if (rv != PP_Error_WouldBlock) | 32 // if (rv != PP_Error_WouldBlock) |
33 // cc->Run(rv); | 33 // cc->Run(rv); |
34 // } | 34 // } |
35 // private: | 35 // private: |
36 // CompletionCallback* NewCallback() { | 36 // CompletionCallback* NewCallback() { |
37 // return factory_.NewCallback(&MyHandler::DidCompleteIO); | 37 // return factory_.NewOptionalCallback(&MyHandler::DidCompleteIO); |
38 // } | 38 // } |
39 // URLRequestInfo MakeRequest(const char* url) { | 39 // URLRequestInfo MakeRequest(const char* url) { |
40 // URLRequestInfo request; | 40 // URLRequestInfo request; |
41 // request.SetURL(url); | 41 // request.SetURL(url); |
42 // request.SetMethod("GET"); | 42 // request.SetMethod("GET"); |
43 // request.SetFollowRedirects(true); | 43 // request.SetFollowRedirects(true); |
44 // return request; | 44 // return request; |
45 // } | 45 // } |
46 // void DidCompleteIO(int32_t result) { | 46 // void DidCompleteIO(int32_t result) { |
47 // if (result > 0) { | 47 // if (result > 0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 int32_t ReadResponseBody(void* buffer, | 100 int32_t ReadResponseBody(void* buffer, |
101 int32_t bytes_to_read, | 101 int32_t bytes_to_read, |
102 const CompletionCallback& cc); | 102 const CompletionCallback& cc); |
103 int32_t FinishStreamingToFile(const CompletionCallback& cc); | 103 int32_t FinishStreamingToFile(const CompletionCallback& cc); |
104 void Close(); | 104 void Close(); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace pp | 107 } // namespace pp |
108 | 108 |
109 #endif // PPAPI_CPP_URL_LOADER_H_ | 109 #endif // PPAPI_CPP_URL_LOADER_H_ |
OLD | NEW |