OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/private/net_address_private.h" | 5 #include "ppapi/cpp/private/net_address_private.h" |
6 | 6 |
7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // static | 44 // static |
45 std::string NetAddressPrivate::Describe(const PP_NetAddress_Private& addr, | 45 std::string NetAddressPrivate::Describe(const PP_NetAddress_Private& addr, |
46 bool include_port) { | 46 bool include_port) { |
47 if (!has_interface<PPB_NetAddress_Private>()) | 47 if (!has_interface<PPB_NetAddress_Private>()) |
48 return std::string(); | 48 return std::string(); |
49 | 49 |
50 Module* module = Module::Get(); | 50 Module* module = Module::Get(); |
51 if (!module) | 51 if (!module) |
52 return std::string(); | 52 return std::string(); |
53 | 53 |
54 Var result(Var::PassRef(), | 54 Var result(PASS_REF, |
55 get_interface<PPB_NetAddress_Private>()->Describe( | 55 get_interface<PPB_NetAddress_Private>()->Describe( |
56 module->pp_module(), | 56 module->pp_module(), |
57 &addr, | 57 &addr, |
58 PP_FromBool(include_port))); | 58 PP_FromBool(include_port))); |
59 return result.is_string() ? result.AsString() : std::string(); | 59 return result.is_string() ? result.AsString() : std::string(); |
60 } | 60 } |
61 | 61 |
62 // static | 62 // static |
63 bool NetAddressPrivate::ReplacePort(const PP_NetAddress_Private& addr_in, | 63 bool NetAddressPrivate::ReplacePort(const PP_NetAddress_Private& addr_in, |
64 uint16_t port, | 64 uint16_t port, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 uint16_t address_size) { | 101 uint16_t address_size) { |
102 if (!has_interface<PPB_NetAddress_Private>()) | 102 if (!has_interface<PPB_NetAddress_Private>()) |
103 return false; | 103 return false; |
104 return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress( | 104 return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress( |
105 &addr, | 105 &addr, |
106 address, | 106 address, |
107 address_size)); | 107 address_size)); |
108 } | 108 } |
109 | 109 |
110 } // namespace pp | 110 } // namespace pp |
OLD | NEW |