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

Side by Side Diff: ppapi/thunk/ppb_flash_tcp_socket_thunk.cc

Issue 7535007: Implement PPB_Flash_TCPSocket.InitiateSSL. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add two missing files. Created 9 years, 4 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 (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 #include "ppapi/c/pp_completion_callback.h" 5 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h" 6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/private/ppb_flash_tcp_socket.h" 7 #include "ppapi/c/private/ppb_flash_tcp_socket.h"
8 #include "ppapi/thunk/common.h" 8 #include "ppapi/thunk/common.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket, 60 PP_Bool GetRemoteAddress(PP_Resource tcp_socket,
61 PP_Flash_NetAddress* remote_addr) { 61 PP_Flash_NetAddress* remote_addr) {
62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); 62 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true);
63 if (enter.failed()) 63 if (enter.failed())
64 return PP_FALSE; 64 return PP_FALSE;
65 return enter.object()->GetRemoteAddress(remote_addr); 65 return enter.object()->GetRemoteAddress(remote_addr);
66 } 66 }
67 67
68 int32_t InitiateSSL(PP_Resource tcp_socket, 68 int32_t SSLHandshake(PP_Resource tcp_socket,
69 const char* server_name, 69 const char* host,
70 PP_CompletionCallback callback) { 70 uint16_t port,
71 PP_CompletionCallback callback) {
71 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); 72 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true);
72 if (enter.failed()) 73 if (enter.failed())
73 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 74 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
74 int32_t result = enter.object()->InitiateSSL(server_name, callback); 75 int32_t result = enter.object()->SSLHandshake(host, port, callback);
75 return MayForceCallback(callback, result); 76 return MayForceCallback(callback, result);
76 } 77 }
77 78
78 int32_t Read(PP_Resource tcp_socket, 79 int32_t Read(PP_Resource tcp_socket,
79 char* buffer, 80 char* buffer,
80 int32_t bytes_to_read, 81 int32_t bytes_to_read,
81 PP_CompletionCallback callback) { 82 PP_CompletionCallback callback) {
82 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true); 83 EnterResource<PPB_Flash_TCPSocket_API> enter(tcp_socket, true);
83 if (enter.failed()) 84 if (enter.failed())
84 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 85 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
(...skipping 18 matching lines...) Expand all
103 enter.object()->Disconnect(); 104 enter.object()->Disconnect();
104 } 105 }
105 106
106 const PPB_Flash_TCPSocket g_ppb_flash_tcp_socket_thunk = { 107 const PPB_Flash_TCPSocket g_ppb_flash_tcp_socket_thunk = {
107 &Create, 108 &Create,
108 &IsFlashTCPSocket, 109 &IsFlashTCPSocket,
109 &Connect, 110 &Connect,
110 &ConnectWithNetAddress, 111 &ConnectWithNetAddress,
111 &GetLocalAddress, 112 &GetLocalAddress,
112 &GetRemoteAddress, 113 &GetRemoteAddress,
113 &InitiateSSL, 114 &SSLHandshake,
114 &Read, 115 &Read,
115 &Write, 116 &Write,
116 &Disconnect 117 &Disconnect
117 }; 118 };
118 119
119 } // namespace 120 } // namespace
120 121
121 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() { 122 const PPB_Flash_TCPSocket* GetPPB_Flash_TCPSocket_Thunk() {
122 return &g_ppb_flash_tcp_socket_thunk; 123 return &g_ppb_flash_tcp_socket_thunk;
123 } 124 }
124 125
125 } // namespace thunk 126 } // namespace thunk
126 } // namespace ppapi 127 } // namespace ppapi
127 128
OLDNEW
« ppapi/c/private/ppb_flash_tcp_socket.h ('K') | « ppapi/thunk/ppb_flash_tcp_socket_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698