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

Side by Side Diff: components/html_viewer/web_socket_handle_impl.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/html_viewer/web_socket_handle_impl.h" 5 #include "components/html_viewer/web_socket_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 25 matching lines...) Expand all
36 36
37 template<> 37 template<>
38 struct TypeConverter<WebSocket::MessageType, WebSocketHandle::MessageType> { 38 struct TypeConverter<WebSocket::MessageType, WebSocketHandle::MessageType> {
39 static WebSocket::MessageType Convert(WebSocketHandle::MessageType type) { 39 static WebSocket::MessageType Convert(WebSocketHandle::MessageType type) {
40 DCHECK(type == WebSocketHandle::MessageTypeContinuation || 40 DCHECK(type == WebSocketHandle::MessageTypeContinuation ||
41 type == WebSocketHandle::MessageTypeText || 41 type == WebSocketHandle::MessageTypeText ||
42 type == WebSocketHandle::MessageTypeBinary); 42 type == WebSocketHandle::MessageTypeBinary);
43 typedef WebSocket::MessageType MessageType; 43 typedef WebSocket::MessageType MessageType;
44 static_assert( 44 static_assert(
45 static_cast<MessageType>(WebSocketHandle::MessageTypeContinuation) == 45 static_cast<MessageType>(WebSocketHandle::MessageTypeContinuation) ==
46 WebSocket::MESSAGE_TYPE_CONTINUATION, 46 WebSocket::MessageType::CONTINUATION,
47 "WebSocket and WebSocketHandle enum values must match"); 47 "WebSocket and WebSocketHandle enum values must match");
48 static_assert(static_cast<MessageType>(WebSocketHandle::MessageTypeText) == 48 static_assert(static_cast<MessageType>(WebSocketHandle::MessageTypeText) ==
49 WebSocket::MESSAGE_TYPE_TEXT, 49 WebSocket::MessageType::TEXT,
50 "WebSocket and WebSocketHandle enum values must match"); 50 "WebSocket and WebSocketHandle enum values must match");
51 static_assert( 51 static_assert(
52 static_cast<MessageType>(WebSocketHandle::MessageTypeBinary) == 52 static_cast<MessageType>(WebSocketHandle::MessageTypeBinary) ==
53 WebSocket::MESSAGE_TYPE_BINARY, 53 WebSocket::MessageType::BINARY,
54 "WebSocket and WebSocketHandle enum values must match"); 54 "WebSocket and WebSocketHandle enum values must match");
55 return static_cast<WebSocket::MessageType>(type); 55 return static_cast<WebSocket::MessageType>(type);
56 } 56 }
57 }; 57 };
58 58
59 template<> 59 template<>
60 struct TypeConverter<WebSocketHandle::MessageType, WebSocket::MessageType> { 60 struct TypeConverter<WebSocketHandle::MessageType, WebSocket::MessageType> {
61 static WebSocketHandle::MessageType Convert(WebSocket::MessageType type) { 61 static WebSocketHandle::MessageType Convert(WebSocket::MessageType type) {
62 DCHECK(type == WebSocket::MESSAGE_TYPE_CONTINUATION || 62 DCHECK(type == WebSocket::MessageType::CONTINUATION ||
63 type == WebSocket::MESSAGE_TYPE_TEXT || 63 type == WebSocket::MessageType::TEXT ||
64 type == WebSocket::MESSAGE_TYPE_BINARY); 64 type == WebSocket::MessageType::BINARY);
65 return static_cast<WebSocketHandle::MessageType>(type); 65 return static_cast<WebSocketHandle::MessageType>(type);
66 } 66 }
67 }; 67 };
68 68
69 } // namespace mojo 69 } // namespace mojo
70 70
71 namespace html_viewer { 71 namespace html_viewer {
72 72
73 // This class forms a bridge from the mojo WebSocketClient interface and the 73 // This class forms a bridge from the mojo WebSocketClient interface and the
74 // Blink WebSocketHandleClient interface. 74 // Blink WebSocketHandleClient interface.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const char* data) { 216 const char* data) {
217 web_socket_->Send(fin, ConvertTo<WebSocket::MessageType>(type), num_bytes); 217 web_socket_->Send(fin, ConvertTo<WebSocket::MessageType>(type), num_bytes);
218 } 218 }
219 219
220 void WebSocketHandleImpl::Disconnect() { 220 void WebSocketHandleImpl::Disconnect() {
221 did_close_ = true; 221 did_close_ = true;
222 client_.reset(); 222 client_.reset();
223 } 223 }
224 224
225 } // namespace html_viewer 225 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/web_layer_tree_view_impl.cc ('k') | components/mus/common/transient_window_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698