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

Unified Diff: mojo/services/network/web_socket_impl.cc

Issue 540683002: Mojo: Implement the rest of the WebSocket interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/network/web_socket_impl.h ('k') | mojo/services/public/interfaces/network/web_socket.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/web_socket_impl.cc
diff --git a/mojo/services/network/web_socket_impl.cc b/mojo/services/network/web_socket_impl.cc
index 252085c492fce8130192b70e1799a9d7874850aa..f65249686584486a85f72fdb59b5fb97710c8646 100644
--- a/mojo/services/network/web_socket_impl.cc
+++ b/mojo/services/network/web_socket_impl.cc
@@ -98,6 +98,8 @@ ChannelState WebSocketEventHandler::OnAddChannelResponse(
const std::string& selected_protocol,
const std::string& extensions) {
client_->DidConnect(fail, selected_protocol, extensions);
+ if (fail)
+ return WebSocketEventInterface::CHANNEL_DELETED;
return WebSocketEventInterface::CHANNEL_ALIVE;
}
@@ -132,13 +134,15 @@ ChannelState WebSocketEventHandler::OnFlowControl(int64 quota) {
}
ChannelState WebSocketEventHandler::OnDropChannel(bool was_clean,
- uint16 code,
- const std::string& reason) {
- return WebSocketEventInterface::CHANNEL_ALIVE;
+ uint16 code,
+ const std::string& reason) {
+ client_->DidClose(was_clean, code, reason);
+ return WebSocketEventInterface::CHANNEL_DELETED;
}
ChannelState WebSocketEventHandler::OnFailChannel(const std::string& message) {
- return WebSocketEventInterface::CHANNEL_ALIVE;
+ client_->DidFail(message);
+ return WebSocketEventInterface::CHANNEL_DELETED;
}
ChannelState WebSocketEventHandler::OnStartOpeningHandshake(
@@ -156,8 +160,8 @@ ChannelState WebSocketEventHandler::OnSSLCertificateError(
const GURL& url,
const net::SSLInfo& ssl_info,
bool fatal) {
- // The above method is always asynchronous.
- return WebSocketEventInterface::CHANNEL_ALIVE;
+ client_->DidFail("SSL Error");
+ return WebSocketEventInterface::CHANNEL_DELETED;
}
} // namespace mojo
@@ -199,10 +203,9 @@ void WebSocketImpl::FlowControl(int64_t quota) {
channel_->SendFlowControl(quota);
}
-void WebSocketImpl::Close(int16_t code, const String& reason) {
+void WebSocketImpl::Close(uint16_t code, const String& reason) {
DCHECK(channel_);
channel_->StartClosingHandshake(code, reason);
}
-
} // namespace mojo
« no previous file with comments | « mojo/services/network/web_socket_impl.h ('k') | mojo/services/public/interfaces/network/web_socket.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698