Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: ppapi/cpp/url_loader.h

Issue 7715005: Changed all @code to <code> and @endcode to </code> as per dmichael (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/paint_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Refer to <code>ppapi/examples/url_loader/streaming.cc</code>
22 /// <strong>Example:</strong> 22 /// for an example of how to use this class.
23 ///
24 /// @code
25 ///
26 /// class MyHandler {
27 /// public:
28 /// MyHandler(Instance* instance)
29 /// : factory_(this),
30 /// loader_(instance),
31 /// did_open_(false) {
32 /// }
33 /// void ProcessURL(const char* url) {
34 /// CompletionCallback* cc = NewCallback();
35 /// int32_t rv = loader_.Open(MakeRequest(url), cc);
36 /// if (rv != PP_Error_WouldBlock)
37 /// cc->Run(rv);
38 /// }
39 /// private:
40 /// CompletionCallback* NewCallback() {
41 /// return factory_.NewOptionalCallback(&MyHandler::DidCompleteIO);
42 /// }
43 /// URLRequestInfo MakeRequest(const char* url) {
44 /// URLRequestInfo request;
45 /// request.SetURL(url);
46 /// request.SetMethod("GET");
47 /// request.SetFollowRedirects(true);
48 /// return request;
49 /// }
50 /// void DidCompleteIO(int32_t result) {
51 /// if (result > 0) {
52 /// // buf_ now contains 'result' number of bytes from the URL.
53 /// ProcessBytes(buf_, result);
54 /// ReadMore();
55 /// } else if (result == PP_OK && !did_open_) {
56 /// // Headers are available, and we can start reading the body.
57 /// did_open_ = true;
58 /// ProcessResponseInfo(loader_.GetResponseInfo());
59 /// ReadMore();
60 /// } else {
61 /// // Done reading (possibly with an error given by 'result').
62 /// }
63 /// }
64 /// void ReadMore() {
65 /// CompletionCallback* cc = NewCallback();
66 /// int32_t rv = fio_.Read(offset_, buf_, sizeof(buf_), cc);
67 /// if (rv != PP_Error_WouldBlock)
68 /// cc->Run(rv);
69 /// }
70 /// void ProcessResponseInfo(const URLResponseInfo& response_info) {
71 /// // Read response headers, etc.
72 /// }
73 /// void ProcessBytes(const char* bytes, int32_t length) {
74 /// // Do work ...
75 /// }
76 /// pp::CompletionCallbackFactory<MyHandler> factory_;
77 /// pp::URLLoader loader_;
78 /// char buf_[4096];
79 /// bool did_open_;
80 /// };
81 /// @endcode
82 class URLLoader : public Resource { 23 class URLLoader : public Resource {
83 public: 24 public:
84 /// Default constructor for creating an is_null() 25 /// Default constructor for creating an is_null()
85 /// <code>URLLoader</code> object. 26 /// <code>URLLoader</code> object.
86 URLLoader() {} 27 URLLoader() {}
87 28
88 // TODO(brettw) remove this when NaCl is updated to use the new version 29 // TODO(brettw) remove this when NaCl is updated to use the new version
89 // that takes a pointer. 30 // that takes a pointer.
90 explicit URLLoader(const Instance& instance); 31 explicit URLLoader(const Instance& instance);
91 32
92 /// A constructor used when a <code>PP_Resource</code> is provided as a 33 /// A constructor used when a <code>PP_Resource</code> is provided as a
93 /// return value whose reference count we need to increment. 34 /// return value whose reference count we need to increment.
94 /// 35 ///
95 /// @param[in] resource A <code>PP_Resource</code>. 36 /// @param[in] resource A <code>PP_Resource</code> corresponding to a
37 /// <code>URLLoader</code> resource.
96 explicit URLLoader(PP_Resource resource); 38 explicit URLLoader(PP_Resource resource);
97 39
98 /// A constructor used to allocate a new URLLoader in the browser. The 40 /// A constructor used to allocate a new URLLoader in the browser. The
99 /// resulting object will be <code>is_null</code> if the allocation failed. 41 /// resulting object will be <code>is_null</code> if the allocation failed.
100 /// 42 ///
101 /// @param[in] instance An <code>Instance</code>. 43 /// @param[in] instance An <code>Instance</code>.
102 explicit URLLoader(Instance* instance); 44 explicit URLLoader(Instance* instance);
103 45
104 /// The copy constructor for <code>URLLoader</code>. 46 /// The copy constructor for <code>URLLoader</code>.
105 /// 47 ///
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 /// 162 ///
221 /// <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed 163 /// <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 164 /// while it is still open, then it will be implicitly closed so you are not
223 /// required to call Close(). 165 /// required to call Close().
224 void Close(); 166 void Close();
225 }; 167 };
226 168
227 } // namespace pp 169 } // namespace pp
228 170
229 #endif // PPAPI_CPP_URL_LOADER_H_ 171 #endif // PPAPI_CPP_URL_LOADER_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/paint_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698