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

Side by Side Diff: runtime/bin/secure_socket_patch.dart

Issue 15899003: Change SecureSocket to use a single patch class instead of multiple patch classes the way it is bei… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « no previous file | runtime/bin/socket_patch.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 patch class SecureSocket { 5 patch class SecureSocket {
6 /* patch */ factory SecureSocket._(RawSecureSocket rawSocket) =>
7 new _SecureSocket(rawSocket);
8
6 /* patch */ static void initialize({String database, 9 /* patch */ static void initialize({String database,
7 String password, 10 String password,
8 bool useBuiltinRoots: true}) 11 bool useBuiltinRoots: true})
9 native "SecureSocket_InitializeLibrary"; 12 native "SecureSocket_InitializeLibrary";
10 } 13 }
11 14
12 15
13 patch class _SecureFilter { 16 patch class _SecureFilter {
14 /* patch */ factory _SecureFilter() => new _SecureFilterImpl(); 17 /* patch */ factory _SecureFilter() => new _SecureFilterImpl();
15 } 18 }
16 19
17 20
21 class _SecureSocket extends _Socket implements SecureSocket {
22 _SecureSocket(RawSecureSocket raw) : super(raw);
23
24 void set onBadCertificate(bool callback(X509Certificate certificate)) {
25 if (_raw == null) {
26 throw new StateError("onBadCertificate called on destroyed SecureSocket");
27 }
28 _raw.onBadCertificate = callback;
29 }
30
31 X509Certificate get peerCertificate {
32 if (_raw == null) {
33 throw new StateError("peerCertificate called on destroyed SecureSocket");
34 }
35 return _raw.peerCertificate;
36 }
37 }
38
39
18 /** 40 /**
19 * _SecureFilterImpl wraps a filter that encrypts and decrypts data travelling 41 * _SecureFilterImpl wraps a filter that encrypts and decrypts data travelling
20 * over an encrypted socket. The filter also handles the handshaking 42 * over an encrypted socket. The filter also handles the handshaking
21 * and certificate verification. 43 * and certificate verification.
22 * 44 *
23 * The filter exposes its input and output buffers as Dart objects that 45 * The filter exposes its input and output buffers as Dart objects that
24 * are backed by an external C array of bytes, so that both Dart code and 46 * are backed by an external C array of bytes, so that both Dart code and
25 * native code can access the same data. 47 * native code can access the same data.
26 */ 48 */
27 class _SecureFilterImpl 49 class _SecureFilterImpl
(...skipping 30 matching lines...) Expand all
58 int processBuffer(int bufferIndex) native "SecureSocket_ProcessBuffer"; 80 int processBuffer(int bufferIndex) native "SecureSocket_ProcessBuffer";
59 81
60 void registerBadCertificateCallback(Function callback) 82 void registerBadCertificateCallback(Function callback)
61 native "SecureSocket_RegisterBadCertificateCallback"; 83 native "SecureSocket_RegisterBadCertificateCallback";
62 84
63 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler) 85 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler)
64 native "SecureSocket_RegisterHandshakeCompleteCallback"; 86 native "SecureSocket_RegisterHandshakeCompleteCallback";
65 87
66 List<_ExternalBuffer> buffers; 88 List<_ExternalBuffer> buffers;
67 } 89 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698