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

Side by Side Diff: mojo/services/html_viewer/web_socket_handle_impl.h

Issue 1099303002: Move html_viewer from mojo/services to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SERVICES_HTML_VIEWER_WEB_SOCKET_HANDLE_IMPL_H_
6 #define MOJO_SERVICES_HTML_VIEWER_WEB_SOCKET_HANDLE_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/common/handle_watcher.h"
11 #include "mojo/services/network/public/interfaces/web_socket.mojom.h"
12 #include "third_party/WebKit/public/platform/WebSocketHandle.h"
13
14 namespace mojo {
15 class NetworkService;
16 class WebSocketWriteQueue;
17 }
18
19 namespace html_viewer {
20
21 class WebSocketClientImpl;
22
23 // Implements WebSocketHandle by talking to the mojo WebSocket interface.
24 class WebSocketHandleImpl : public blink::WebSocketHandle {
25 public:
26 explicit WebSocketHandleImpl(mojo::NetworkService* network_service);
27
28 private:
29 friend class WebSocketClientImpl;
30
31 virtual ~WebSocketHandleImpl();
32
33 // blink::WebSocketHandle methods:
34 virtual void connect(const blink::WebURL& url,
35 const blink::WebVector<blink::WebString>& protocols,
36 const blink::WebSerializedOrigin& origin,
37 blink::WebSocketHandleClient*);
38 virtual void send(bool fin, MessageType, const char* data, size_t size);
39 virtual void flowControl(int64_t quota);
40 virtual void close(unsigned short code, const blink::WebString& reason);
41
42 // Called when we finished writing to |send_stream_|.
43 void DidWriteToSendStream(bool fin,
44 WebSocketHandle::MessageType type,
45 uint32_t num_bytes,
46 const char* data);
47
48 // Called when the socket is closed.
49 void Disconnect();
50
51 mojo::WebSocketPtr web_socket_;
52 scoped_ptr<WebSocketClientImpl> client_;
53 mojo::ScopedDataPipeProducerHandle send_stream_;
54 scoped_ptr<mojo::WebSocketWriteQueue> write_queue_;
55 // True if close() was called.
56 bool did_close_;
57
58 DISALLOW_COPY_AND_ASSIGN(WebSocketHandleImpl);
59 };
60
61 } // namespace html_viewer
62
63 #endif // MOJO_SERVICES_HTML_VIEWER_WEB_SOCKET_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/services/html_viewer/web_scheduler_impl.cc ('k') | mojo/services/html_viewer/web_socket_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698