| 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..1d739a7f7bc028376bbb6f1bc37422231fdacb1c
|
| --- /dev/null
|
| +++ b/content/renderer/websockethandle_impl.h
|
| @@ -0,0 +1,89 @@
|
| +// 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>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/weak_ptr.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 WebSecurityOrigin;
|
| +class WebString;
|
| +class WebURL;
|
| +} // namespace blink
|
| +
|
| +namespace shell {
|
| +class InterfaceProvider;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class WebSocketHandleImpl : public blink::WebSocketHandle,
|
| + public mojom::WebSocketClient {
|
| + public:
|
| + WebSocketHandleImpl();
|
| +
|
| + // This must be called before connect() and may be called more than once.
|
| + // This serves as a way to lazily construct the WebSocketPtr to support
|
| + // SharedWorkers, which do not have an associated WebFrame and hence no
|
| + // willOpenSocketHandle notification.
|
| + void SetInterfaceProvider(
|
| + const base::WeakPtr<shell::InterfaceProvider>& interface_provider);
|
| +
|
| + // blink::WebSocketHandle methods:
|
| + void connect(const blink::WebURL& url,
|
| + const blink::WebVector<blink::WebString>& protocols,
|
| + const blink::WebSecurityOrigin& origin,
|
| + 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;
|
| +
|
| + base::WeakPtr<shell::InterfaceProvider> interface_provider_;
|
| +
|
| + blink::WebSocketHandleClient* client_;
|
| +
|
| + mojom::WebSocketPtr websocket_;
|
| + mojo::Binding<mojom::WebSocketClient> client_binding_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebSocketHandleImpl);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_RENDERER_WEBSOCKETHANDLE_IMPl_H_
|
|
|