| 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 #include "content/browser/renderer_host/websocket_host.h" | 5 #include "content/browser/renderer_host/websocket_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | 10 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 WebSocketEventHandler(WebSocketDispatcherHost* dispatcher, | 88 WebSocketEventHandler(WebSocketDispatcherHost* dispatcher, |
| 89 int routing_id, | 89 int routing_id, |
| 90 int render_frame_id); | 90 int render_frame_id); |
| 91 virtual ~WebSocketEventHandler(); | 91 virtual ~WebSocketEventHandler(); |
| 92 | 92 |
| 93 // net::WebSocketEventInterface implementation | 93 // net::WebSocketEventInterface implementation |
| 94 | 94 |
| 95 virtual ChannelState OnAddChannelResponse( | 95 virtual ChannelState OnAddChannelResponse( |
| 96 bool fail, | 96 bool fail, |
| 97 const std::string& selected_subprotocol, | 97 const std::string& selected_subprotocol, |
| 98 const std::string& extensions) OVERRIDE; | 98 const std::string& extensions) override; |
| 99 virtual ChannelState OnDataFrame(bool fin, | 99 virtual ChannelState OnDataFrame(bool fin, |
| 100 WebSocketMessageType type, | 100 WebSocketMessageType type, |
| 101 const std::vector<char>& data) OVERRIDE; | 101 const std::vector<char>& data) override; |
| 102 virtual ChannelState OnClosingHandshake() OVERRIDE; | 102 virtual ChannelState OnClosingHandshake() override; |
| 103 virtual ChannelState OnFlowControl(int64 quota) OVERRIDE; | 103 virtual ChannelState OnFlowControl(int64 quota) override; |
| 104 virtual ChannelState OnDropChannel(bool was_clean, | 104 virtual ChannelState OnDropChannel(bool was_clean, |
| 105 uint16 code, | 105 uint16 code, |
| 106 const std::string& reason) OVERRIDE; | 106 const std::string& reason) override; |
| 107 virtual ChannelState OnFailChannel(const std::string& message) OVERRIDE; | 107 virtual ChannelState OnFailChannel(const std::string& message) override; |
| 108 virtual ChannelState OnStartOpeningHandshake( | 108 virtual ChannelState OnStartOpeningHandshake( |
| 109 scoped_ptr<net::WebSocketHandshakeRequestInfo> request) OVERRIDE; | 109 scoped_ptr<net::WebSocketHandshakeRequestInfo> request) override; |
| 110 virtual ChannelState OnFinishOpeningHandshake( | 110 virtual ChannelState OnFinishOpeningHandshake( |
| 111 scoped_ptr<net::WebSocketHandshakeResponseInfo> response) OVERRIDE; | 111 scoped_ptr<net::WebSocketHandshakeResponseInfo> response) override; |
| 112 virtual ChannelState OnSSLCertificateError( | 112 virtual ChannelState OnSSLCertificateError( |
| 113 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks, | 113 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks, |
| 114 const GURL& url, | 114 const GURL& url, |
| 115 const net::SSLInfo& ssl_info, | 115 const net::SSLInfo& ssl_info, |
| 116 bool fatal) OVERRIDE; | 116 bool fatal) override; |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 class SSLErrorHandlerDelegate : public SSLErrorHandler::Delegate { | 119 class SSLErrorHandlerDelegate : public SSLErrorHandler::Delegate { |
| 120 public: | 120 public: |
| 121 SSLErrorHandlerDelegate( | 121 SSLErrorHandlerDelegate( |
| 122 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks); | 122 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks); |
| 123 virtual ~SSLErrorHandlerDelegate(); | 123 virtual ~SSLErrorHandlerDelegate(); |
| 124 | 124 |
| 125 base::WeakPtr<SSLErrorHandler::Delegate> GetWeakPtr(); | 125 base::WeakPtr<SSLErrorHandler::Delegate> GetWeakPtr(); |
| 126 | 126 |
| 127 // SSLErrorHandler::Delegate methods | 127 // SSLErrorHandler::Delegate methods |
| 128 virtual void CancelSSLRequest(int error, | 128 virtual void CancelSSLRequest(int error, |
| 129 const net::SSLInfo* ssl_info) OVERRIDE; | 129 const net::SSLInfo* ssl_info) override; |
| 130 virtual void ContinueSSLRequest() OVERRIDE; | 130 virtual void ContinueSSLRequest() override; |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks_; | 133 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks_; |
| 134 base::WeakPtrFactory<SSLErrorHandlerDelegate> weak_ptr_factory_; | 134 base::WeakPtrFactory<SSLErrorHandlerDelegate> weak_ptr_factory_; |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandlerDelegate); | 136 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandlerDelegate); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 WebSocketDispatcherHost* const dispatcher_; | 139 WebSocketDispatcherHost* const dispatcher_; |
| 140 const int routing_id_; | 140 const int routing_id_; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 DVLOG(3) << "WebSocketHost::OnDropChannel" | 385 DVLOG(3) << "WebSocketHost::OnDropChannel" |
| 386 << " routing_id=" << routing_id_ << " was_clean=" << was_clean | 386 << " routing_id=" << routing_id_ << " was_clean=" << was_clean |
| 387 << " code=" << code << " reason=\"" << reason << "\""; | 387 << " code=" << code << " reason=\"" << reason << "\""; |
| 388 | 388 |
| 389 DCHECK(channel_); | 389 DCHECK(channel_); |
| 390 // TODO(yhirano): Handle |was_clean| appropriately. | 390 // TODO(yhirano): Handle |was_clean| appropriately. |
| 391 channel_->StartClosingHandshake(code, reason); | 391 channel_->StartClosingHandshake(code, reason); |
| 392 } | 392 } |
| 393 | 393 |
| 394 } // namespace content | 394 } // namespace content |
| OLD | NEW |