OLD | NEW |
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 NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT | 12 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 | 14 |
| 15 class GURL; |
| 16 |
15 namespace net { | 17 namespace net { |
16 | 18 |
| 19 class SSLInfo; |
17 struct WebSocketHandshakeRequestInfo; | 20 struct WebSocketHandshakeRequestInfo; |
18 struct WebSocketHandshakeResponseInfo; | 21 struct WebSocketHandshakeResponseInfo; |
19 | 22 |
20 // Interface for events sent from the network layer to the content layer. These | 23 // Interface for events sent from the network layer to the content layer. These |
21 // events will generally be sent as-is to the renderer process. | 24 // events will generally be sent as-is to the renderer process. |
22 class NET_EXPORT WebSocketEventInterface { | 25 class NET_EXPORT WebSocketEventInterface { |
23 public: | 26 public: |
24 typedef int WebSocketMessageType; | 27 typedef int WebSocketMessageType; |
25 | 28 |
26 // Any event can cause the Channel to be deleted. The Channel needs to avoid | 29 // Any event can cause the Channel to be deleted. The Channel needs to avoid |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 95 |
93 // Called when the browser starts the WebSocket Opening Handshake. | 96 // Called when the browser starts the WebSocket Opening Handshake. |
94 virtual ChannelState OnStartOpeningHandshake( | 97 virtual ChannelState OnStartOpeningHandshake( |
95 scoped_ptr<WebSocketHandshakeRequestInfo> request) WARN_UNUSED_RESULT = 0; | 98 scoped_ptr<WebSocketHandshakeRequestInfo> request) WARN_UNUSED_RESULT = 0; |
96 | 99 |
97 // Called when the browser finishes the WebSocket Opening Handshake. | 100 // Called when the browser finishes the WebSocket Opening Handshake. |
98 virtual ChannelState OnFinishOpeningHandshake( | 101 virtual ChannelState OnFinishOpeningHandshake( |
99 scoped_ptr<WebSocketHandshakeResponseInfo> response) | 102 scoped_ptr<WebSocketHandshakeResponseInfo> response) |
100 WARN_UNUSED_RESULT = 0; | 103 WARN_UNUSED_RESULT = 0; |
101 | 104 |
| 105 // Callbacks to be used in response to a call to OnSSLCertificateError. Very |
| 106 // similar to content::SSLErrorHandler::Delegate (which we can't use directly |
| 107 // due to layering constraints). |
| 108 class NET_EXPORT SSLErrorCallbacks { |
| 109 public: |
| 110 virtual ~SSLErrorCallbacks() {} |
| 111 |
| 112 // Cancels the SSL response in response to the error. |
| 113 virtual void CancelSSLRequest(int error, const SSLInfo* ssl_info) = 0; |
| 114 |
| 115 // Continue with the SSL connection despite the error. |
| 116 virtual void ContinueSSLRequest() = 0; |
| 117 }; |
| 118 |
| 119 // Called on SSL Certificate Error during the SSL handshake. Should result in |
| 120 // a call to either ssl_error_callbacks->ContinueSSLRequest() or |
| 121 // ssl_error_callbacks->CancelSSLRequest(). Normally the implementation of |
| 122 // this method will delegate to content::SSLManager::OnSSLCertificateError to |
| 123 // make the actual decision. The callbacks must not be called after the |
| 124 // WebSocketChannel has been destroyed. |
| 125 virtual ChannelState OnSSLCertificateError( |
| 126 scoped_ptr<SSLErrorCallbacks> ssl_error_callbacks, |
| 127 const GURL& url, |
| 128 const SSLInfo& ssl_info, |
| 129 bool fatal) WARN_UNUSED_RESULT = 0; |
| 130 |
102 protected: | 131 protected: |
103 WebSocketEventInterface() {} | 132 WebSocketEventInterface() {} |
104 | 133 |
105 private: | 134 private: |
106 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); | 135 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); |
107 }; | 136 }; |
108 | 137 |
109 } // namespace net | 138 } // namespace net |
110 | 139 |
111 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 140 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
OLD | NEW |