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

Side by Side Diff: ppapi/cpp/dev/host_resolver_dev.h

Issue 16938011: Update comments of the Pepper networking APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DEV_HOST_RESOLVER_DEV_H_ 5 #ifndef PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_
6 #define PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_ 6 #define PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_
7 7
8 #include "ppapi/c/pp_stdint.h" 8 #include "ppapi/c/pp_stdint.h"
9 #include "ppapi/c/dev/ppb_host_resolver_dev.h" 9 #include "ppapi/c/dev/ppb_host_resolver_dev.h"
10 #include "ppapi/cpp/dev/net_address_dev.h" 10 #include "ppapi/cpp/dev/net_address_dev.h"
11 #include "ppapi/cpp/pass_ref.h" 11 #include "ppapi/cpp/pass_ref.h"
12 #include "ppapi/cpp/resource.h" 12 #include "ppapi/cpp/resource.h"
13 #include "ppapi/cpp/var.h" 13 #include "ppapi/cpp/var.h"
14 14
15 namespace pp { 15 namespace pp {
16 16
17 class CompletionCallback; 17 class CompletionCallback;
18 class InstanceHandle; 18 class InstanceHandle;
19 19
20 /// The <code>HostResolver_Dev</code> class supports host name resolution.
21 ///
22 /// Permissions: In order to run <code>Resolve()</code>, apps permission
23 /// <code>socket</code> with subrule <code>resolve-host</code> is required.
24 /// For more details about network communication permissions, please see:
25 /// http://developer.chrome.com/apps/app_network.html
20 class HostResolver_Dev : public Resource { 26 class HostResolver_Dev : public Resource {
21 public: 27 public:
28 /// Default constructor for creating an is_null()
29 /// <code>HostResolver_Dev</code> object.
22 HostResolver_Dev(); 30 HostResolver_Dev();
23 31
32 /// A contructor used to create a <code>HostResolver_Dev</code> object.
33 ///
34 /// @param[in] instance The instance with which this resource will be
35 /// associated.
24 explicit HostResolver_Dev(const InstanceHandle& instance); 36 explicit HostResolver_Dev(const InstanceHandle& instance);
25 37
38 /// A constructor used when you have received a <code>PP_Resource</code> as a
39 /// return value that has already been added 1 ref for you.
40 ///
41 /// @param[in] resource A <code>PPB_HostResolver_Dev</code> resource.
26 HostResolver_Dev(PassRef, PP_Resource resource); 42 HostResolver_Dev(PassRef, PP_Resource resource);
27 43
44 /// The copy constructor for <code>HostResolver_Dev</code>.
45 ///
46 /// @param[in] other A reference to another <code>HostResolver_Dev</code>.
28 HostResolver_Dev(const HostResolver_Dev& other); 47 HostResolver_Dev(const HostResolver_Dev& other);
29 48
49 /// The destructor.
30 virtual ~HostResolver_Dev(); 50 virtual ~HostResolver_Dev();
31 51
52 /// The assign operator for <code>HostResolver_Dev</code>.
53 ///
54 /// @param[in] other A reference to another <code>HostResolver_Dev</code>.
55 ///
56 /// @return A reference to this <code>HostResolver_Dev</code> object.
32 HostResolver_Dev& operator=(const HostResolver_Dev& other); 57 HostResolver_Dev& operator=(const HostResolver_Dev& other);
33 58
34 // Returns true if the required interface is available. 59 /// Static function for determining whether the browser supports the required
60 /// <code>PPB_HostResolver_Dev</code> interface.
61 ///
62 /// @return true if the interface is available, false otherwise.
35 static bool IsAvailable(); 63 static bool IsAvailable();
36 64
65 /// Requests to resolve a host name. When the call completes successully, the
66 /// results can be retrieved by <code>GetCanonicalName()</code>,
67 /// <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>.
68 ///
69 /// @param[in] host The host name (or IP address literal) to resolve.
70 /// @param[in] port The port number to be set in the resulting network
71 /// addresses.
72 /// @param[in] hint A <code>PP_HostResolver_Hint_Dev</code> structure
73 /// providing hints for host resolution.
74 /// @param[in] callback A <code>CompletionCallback</code> to be called upon
75 /// completion.
76 ///
77 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
78 /// <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have
79 /// required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be
80 /// returned if the host name couldn't be resolved.
37 int32_t Resolve(const char* host, 81 int32_t Resolve(const char* host,
38 uint16_t port, 82 uint16_t port,
39 const PP_HostResolver_Hint_Dev& hint, 83 const PP_HostResolver_Hint_Dev& hint,
40 const CompletionCallback& callback); 84 const CompletionCallback& callback);
85
86 /// Gets the canonical name of the host.
87 ///
88 /// @return A string <code>Var</code> on success, which is an empty string
89 /// if <code>PP_HOSTRESOLVER_FLAGS_CANONNAME</code> is not specified when
90 /// calling <code>Resolve()</code>; an undefined <code>Var</code> if there
91 /// is a pending <code>Resolve()</code> call or the previous
92 /// <code>Resolve()</code> call failed.
41 Var GetCanonicalName() const; 93 Var GetCanonicalName() const;
94
95 /// Gets the number of network addresses.
96 ///
97 /// @return The number of available network addresses on success; 0 if there
98 /// is a pending <code>Resolve()</code> call or the previous
99 /// <code>Resolve()</code> call failed.
42 uint32_t GetNetAddressCount() const; 100 uint32_t GetNetAddressCount() const;
101
102 /// Gets a network address.
103 ///
104 /// @param[in] index An index indicating which address to return.
105 ///
106 /// @return A <code>NetAddress_Dev</code> object. The object will be null
107 /// (i.e., is_null() returns true) if there is a pending
108 /// <code>Resolve()</code> call or the previous <code>Resolve()</code> call
109 /// failed, or the specified index is out of range.
43 NetAddress_Dev GetNetAddress(uint32_t index) const; 110 NetAddress_Dev GetNetAddress(uint32_t index) const;
44 }; 111 };
45 112
46 } // namespace pp 113 } // namespace pp
47 114
48 #endif // PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_ 115 #endif // PPAPI_CPP_DEV_HOST_RESOLVER_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698