electron/shell/browser/net/url_loader_network_observer.h
electron-roller[bot] 7e7010dacf
chore: bump chromium to 133.0.6852.0 (main) (#44748)
* chore: bump chromium in DEPS to 133.0.6847.0

* chore: bump chromium in DEPS to 133.0.6848.0

* chore: update patches

* implement extensions::GlobalShortcutListener::ExecuteCommand stub

https://chromium-review.googlesource.com/c/chromium/src/+/5871484

* fix: ismediakey patch, oops

* fix: another missing bracket

* chore: bump chromium in DEPS to 133.0.6850.0

* chore: update patches

* SharedStorageOperationPtr -> SharedStorageModifierMethodPtr

https://chromium-review.googlesource.com/c/chromium/src/+/5990970

* build GlobalShortcutListenerLinux

https://chromium-review.googlesource.com/c/chromium/src/+/5871484

* chore: bump chromium in DEPS to 133.0.6851.0

* fix: include full type for network::mojom::SharedStorageModifierMethod

* chore: update patches

* chore: bump chromium in DEPS to 133.0.6852.0

* chore: update patches

* build: remove duplicated icudtl.dat and snapshot_blob.bin

https://chromium-review.googlesource.com/c/chromium/src/+/5999387

* fix: include static methods in node tests involving call stacks

https://chromium-review.googlesource.com/c/v8/v8/+/5907815

* revert: moved code in picture-in-picture.patch

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
2024-11-25 10:45:47 -05:00

82 lines
3.5 KiB
C++

// Copyright (c) 2024 Microsoft, GmbH
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_NET_URL_LOADER_NETWORK_OBSERVER_H_
#define ELECTRON_SHELL_BROWSER_NET_URL_LOADER_NETWORK_OBSERVER_H_
#include "base/memory/weak_ptr.h"
#include "base/process/process_handle.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h"
namespace electron {
class URLLoaderNetworkObserver
: public network::mojom::URLLoaderNetworkServiceObserver {
public:
URLLoaderNetworkObserver();
~URLLoaderNetworkObserver() override;
URLLoaderNetworkObserver(const URLLoaderNetworkObserver&) = delete;
URLLoaderNetworkObserver& operator=(const URLLoaderNetworkObserver&) = delete;
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver> Bind();
void set_process_id(base::ProcessId pid) { process_id_ = pid; }
private:
void OnAuthRequired(
const std::optional<base::UnguessableToken>& window_id,
int32_t request_id,
const GURL& url,
bool first_auth_attempt,
const net::AuthChallengeInfo& auth_info,
const scoped_refptr<net::HttpResponseHeaders>& head_headers,
mojo::PendingRemote<network::mojom::AuthChallengeResponder>
auth_challenge_responder) override;
void OnSSLCertificateError(const GURL& url,
int net_error,
const net::SSLInfo& ssl_info,
bool fatal,
OnSSLCertificateErrorCallback response) override;
void OnClearSiteData(
const GURL& url,
const std::string& header_value,
int32_t load_flags,
const std::optional<net::CookiePartitionKey>& cookie_partition_key,
bool partitioned_state_allowed_only,
OnClearSiteDataCallback callback) override;
void OnLoadingStateUpdate(network::mojom::LoadInfoPtr info,
OnLoadingStateUpdateCallback callback) override;
void OnSharedStorageHeaderReceived(
const url::Origin& request_origin,
std::vector<network::mojom::SharedStorageModifierMethodPtr> methods,
OnSharedStorageHeaderReceivedCallback callback) override;
void OnDataUseUpdate(int32_t network_traffic_annotation_id_hash,
int64_t recv_bytes,
int64_t sent_bytes) override {}
void OnWebSocketConnectedToPrivateNetwork(
network::mojom::IPAddressSpace ip_address_space) override {}
void OnCertificateRequested(
const std::optional<base::UnguessableToken>& window_id,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
client_cert_responder) override {}
void OnPrivateNetworkAccessPermissionRequired(
const GURL& url,
const net::IPAddress& ip_address,
const std::optional<std::string>& private_network_device_id,
const std::optional<std::string>& private_network_device_name,
OnPrivateNetworkAccessPermissionRequiredCallback callback) override {}
void Clone(
mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver>
observer) override;
mojo::ReceiverSet<network::mojom::URLLoaderNetworkServiceObserver> receivers_;
base::ProcessId process_id_ = base::kNullProcessId;
base::WeakPtrFactory<URLLoaderNetworkObserver> weak_factory_{this};
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_NET_URL_LOADER_NETWORK_OBSERVER_H_