OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 /// @file | 11 /// @file |
12 /// This file defines the API for loading URLs. | 12 /// This file defines the API for loading URLs. |
13 namespace pp { | 13 namespace pp { |
14 | 14 |
15 class CompletionCallback; | 15 class CompletionCallback; |
16 class Instance; | 16 class Instance; |
17 class URLRequestInfo; | 17 class URLRequestInfo; |
18 class URLResponseInfo; | 18 class URLResponseInfo; |
19 | 19 |
20 /// URLLoader provides an API for loading URLs. | 20 /// URLLoader provides an API for loading URLs. |
21 /// | 21 /// |
22 /// <strong>Example:</strong> | 22 /// <strong>Example:</strong> |
23 /// | 23 /// |
24 /// @code | 24 /// <code> |
25 /// | 25 /// |
26 /// class MyHandler { | 26 /// class MyHandler { |
27 /// public: | 27 /// public: |
28 /// MyHandler(Instance* instance) | 28 /// MyHandler(Instance* instance) |
29 /// : factory_(this), | 29 /// : factory_(this), |
30 /// loader_(instance), | 30 /// loader_(instance), |
31 /// did_open_(false) { | 31 /// did_open_(false) { |
32 /// } | 32 /// } |
33 /// void ProcessURL(const char* url) { | 33 /// void ProcessURL(const char* url) { |
34 /// CompletionCallback* cc = NewCallback(); | 34 /// CompletionCallback* cc = NewCallback(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 /// // Read response headers, etc. | 71 /// // Read response headers, etc. |
72 /// } | 72 /// } |
73 /// void ProcessBytes(const char* bytes, int32_t length) { | 73 /// void ProcessBytes(const char* bytes, int32_t length) { |
74 /// // Do work ... | 74 /// // Do work ... |
75 /// } | 75 /// } |
76 /// pp::CompletionCallbackFactory<MyHandler> factory_; | 76 /// pp::CompletionCallbackFactory<MyHandler> factory_; |
77 /// pp::URLLoader loader_; | 77 /// pp::URLLoader loader_; |
78 /// char buf_[4096]; | 78 /// char buf_[4096]; |
79 /// bool did_open_; | 79 /// bool did_open_; |
80 /// }; | 80 /// }; |
81 /// @endcode | 81 /// </code> |
82 class URLLoader : public Resource { | 82 class URLLoader : public Resource { |
83 public: | 83 public: |
84 /// Default constructor for creating an is_null() | 84 /// Default constructor for creating an is_null() |
85 /// <code>URLLoader</code> object. | 85 /// <code>URLLoader</code> object. |
86 URLLoader() {} | 86 URLLoader() {} |
87 | 87 |
88 // TODO(brettw) remove this when NaCl is updated to use the new version | 88 // TODO(brettw) remove this when NaCl is updated to use the new version |
89 // that takes a pointer. | 89 // that takes a pointer. |
90 explicit URLLoader(const Instance& instance); | 90 explicit URLLoader(const Instance& instance); |
91 | 91 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 /// | 220 /// |
221 /// <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed | 221 /// <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed |
222 /// while it is still open, then it will be implicitly closed so you are not | 222 /// while it is still open, then it will be implicitly closed so you are not |
223 /// required to call Close(). | 223 /// required to call Close(). |
224 void Close(); | 224 void Close(); |
225 }; | 225 }; |
226 | 226 |
227 } // namespace pp | 227 } // namespace pp |
228 | 228 |
229 #endif // PPAPI_CPP_URL_LOADER_H_ | 229 #endif // PPAPI_CPP_URL_LOADER_H_ |
OLD | NEW |