Chromium Code Reviews| Index: content/renderer/websockethandle_impl.h |
| diff --git a/content/renderer/websockethandle_impl.h b/content/renderer/websockethandle_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f65587401d425e6eb1d0376c18629281f4d78b3c |
| --- /dev/null |
| +++ b/content/renderer/websockethandle_impl.h |
| @@ -0,0 +1,90 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_ |
| +#define CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_ |
| + |
| +#include <stddef.h> |
| +#include <stdint.h> |
| +#include <string> |
|
Adam Rice
2016/07/27 02:38:54
<string> and <vector> unused?
|
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "content/common/websocket.mojom.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| +#include "third_party/WebKit/public/platform/WebVector.h" |
| +#include "third_party/WebKit/public/platform/modules/websockets/WebSocketHandle.h" |
| + |
| +namespace blink { |
| +class ServiceRegistry; |
| +class WebSecurityOrigin; |
| +class WebString; |
| +class WebURL; |
| +} // namespace blink |
| + |
| +namespace shell { |
| +class InterfaceProvider; |
| +} // namespace shell |
| + |
| +namespace content { |
| + |
| +class WebSocketHandleImpl : public blink::WebSocketHandle, |
| + public mojom::WebSocketClient { |
| + public: |
| + WebSocketHandleImpl( |
| + blink::ServiceRegistry* service_registry, |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| + |
| + void set_render_frame_id(int32_t render_frame_id) { |
| + render_frame_id_ = render_frame_id; |
| + } |
| + |
| + // blink::WebSocketHandle methods: |
| + void connect(const blink::WebURL& url, |
| + const blink::WebVector<blink::WebString>& protocols, |
| + const blink::WebSecurityOrigin& origin, |
| + const blink::WebURL& first_party_for_cookies, |
| + const blink::WebString& user_agent_override, |
| + blink::WebSocketHandleClient* client) override; |
| + void send(bool fin, |
| + WebSocketHandle::MessageType type, |
| + const char* data, |
| + size_t size) override; |
| + void flowControl(int64_t quota) override; |
| + void close(unsigned short code, const blink::WebString& reason) override; |
| + |
| + private: |
| + ~WebSocketHandleImpl() override; |
| + void Disconnect(); |
| + void OnConnectionError(); |
| + |
| + // mojom::WebSocketClient methods: |
| + void OnFailChannel(const mojo::String& reason) override; |
| + void OnStartOpeningHandshake( |
| + mojom::WebSocketHandshakeRequestPtr request) override; |
| + void OnFinishOpeningHandshake( |
| + mojom::WebSocketHandshakeResponsePtr response) override; |
| + void OnAddChannelResponse(const mojo::String& selected_protocol, |
| + const mojo::String& extensions) override; |
| + void OnDataFrame(bool fin, mojom::WebSocketMessageType type, |
| + mojo::Array<uint8_t> data) override; |
| + void OnFlowControl(int64_t quota) override; |
| + void OnDropChannel(bool was_clean, uint16_t code, |
| + const mojo::String& reason) override; |
| + void OnClosingHandshake() override; |
| + |
| + blink::WebSocketHandleClient* client_; |
| + |
| + mojom::WebSocketPtr websocket_; |
| + mojo::Binding<mojom::WebSocketClient> client_binding_; |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + int32_t render_frame_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebSocketHandleImpl); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_ |