chromium/extensions/browser/api/web_request/web_request_proxying_websocket.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/api/web_request/web_request_proxying_websocket.h"

#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/web_request/extension_web_request_event_router.h"
#include "extensions/browser/api/web_request/permission_helper.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_navigation_ui_data.h"
#include "net/base/ip_endpoint.h"
#include "net/cookies/site_for_cookies.h"
#include "net/http/http_util.h"

namespace extensions {
namespace {

// This shutdown notifier makes sure the proxy is destroyed if an incognito
// browser context is destroyed. This is needed because WebRequestAPI only
// clears the proxies when the original browser context is destroyed.
class ShutdownNotifierFactory
    : public BrowserContextKeyedServiceShutdownNotifierFactory {};

}  // namespace

WebRequestProxyingWebSocket::WebRequestProxyingWebSocket(
    WebSocketFactory factory,
    const network::ResourceRequest& request,
    mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
        handshake_client,
    bool has_extra_headers,
    int process_id,
    int render_frame_id,
    content::BrowserContext* browser_context,
    WebRequestAPI::RequestIDGenerator* request_id_generator,
    WebRequestAPI::ProxySet* proxies)
    :{}

WebRequestProxyingWebSocket::~WebRequestProxyingWebSocket() {}

void WebRequestProxyingWebSocket::Start() {}

void WebRequestProxyingWebSocket::OnOpeningHandshakeStarted(
    network::mojom::WebSocketHandshakeRequestPtr request) {}

void WebRequestProxyingWebSocket::OnFailure(const std::string&,
                                            int net_error,
                                            int response_code) {}

void WebRequestProxyingWebSocket::ContinueToHeadersReceived() {}

void WebRequestProxyingWebSocket::OnConnectionEstablished(
    mojo::PendingRemote<network::mojom::WebSocket> websocket,
    mojo::PendingReceiver<network::mojom::WebSocketClient> client_receiver,
    network::mojom::WebSocketHandshakeResponsePtr response,
    mojo::ScopedDataPipeConsumerHandle readable,
    mojo::ScopedDataPipeProducerHandle writable) {}

void WebRequestProxyingWebSocket::ContinueToCompleted() {}

void WebRequestProxyingWebSocket::OnAuthRequired(
    const net::AuthChallengeInfo& auth_info,
    const scoped_refptr<net::HttpResponseHeaders>& headers,
    const net::IPEndPoint& remote_endpoint,
    OnAuthRequiredCallback callback) {}

void WebRequestProxyingWebSocket::OnBeforeSendHeaders(
    const net::HttpRequestHeaders& headers,
    OnBeforeSendHeadersCallback callback) {}

void WebRequestProxyingWebSocket::OnHeadersReceived(
    const std::string& headers,
    const net::IPEndPoint& endpoint,
    OnHeadersReceivedCallback callback) {}

void WebRequestProxyingWebSocket::OnDNRExtensionUnloaded(
    const Extension* extension) {}

void WebRequestProxyingWebSocket::StartProxying(
    WebSocketFactory factory,
    const GURL& url,
    const net::SiteForCookies& site_for_cookies,
    const std::optional<std::string>& user_agent,
    mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
        handshake_client,
    bool has_extra_headers,
    int process_id,
    int render_frame_id,
    WebRequestAPI::RequestIDGenerator* request_id_generator,
    const url::Origin& origin,
    content::BrowserContext* browser_context,
    WebRequestAPI::ProxySet* proxies) {}

void WebRequestProxyingWebSocket::OnBeforeRequestComplete(int error_code) {}

void WebRequestProxyingWebSocket::OnBeforeSendHeadersComplete(
    const std::set<std::string>& removed_headers,
    const std::set<std::string>& set_headers,
    int error_code) {}

void WebRequestProxyingWebSocket::ContinueToStartRequest(int error_code) {}

void WebRequestProxyingWebSocket::OnHeadersReceivedComplete(int error_code) {}

void WebRequestProxyingWebSocket::OnAuthRequiredComplete(
    WebRequestEventRouter::AuthRequiredResponse rv) {}

void WebRequestProxyingWebSocket::OnHeadersReceivedCompleteForAuth(
    const net::AuthChallengeInfo& auth_info,
    int rv) {}

void WebRequestProxyingWebSocket::PauseIncomingMethodCallProcessing() {}

void WebRequestProxyingWebSocket::ResumeIncomingMethodCallProcessing() {}

void WebRequestProxyingWebSocket::OnError(int error_code) {}

void WebRequestProxyingWebSocket::OnMojoConnectionErrorWithCustomReason(
    uint32_t custom_reason,
    const std::string& description) {}

void WebRequestProxyingWebSocket::OnMojoConnectionError() {}

// static
void WebRequestProxyingWebSocket::EnsureAssociatedFactoryBuilt() {}

}  // namespace extensions