81c143318b
* chore: bump chromium in DEPS to 94.0.4587.0 * chore: update patches * 2823155: fix GPU video decoding capabilities enumeration Ref: https://chromium-review.googlesource.com/c/chromium/src/+/2823155 * 3041383: Reduce includes in url_request_mojom_traits.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3041383 * chore: bump chromium in DEPS to 94.0.4588.0 * chore: update patches * chore: bump chromium in DEPS to 94.0.4589.0 * chore: update patches * 3050633: Rename ScaleFactor to ResourceScaleFactor Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3050633 * 3048296: Create new mojo target to prevent traits header spreading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3048296 * 3046186: Rename base::ClampToRange Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3046186 * chore: update picture-in-picture patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056037 * chore: bump chromium in DEPS to 94.0.4590.0 * chore: update patches * 3057495: Fix base::NoDestructor usage in Mac KeychainPassword Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3057495 * 3056134: Remove NetworkIsolationKey unused methods Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3056134 * 3035091: [rab/gsab] Fix gsab maxByteLength after transferring to worker Adds a patch to v8 to disable a DCHECK that is also firing on node streams in child processes. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3035091 * chore: bump chromium in DEPS to 94.0.4590.2 * chore: fix mas_no_private_api.patch Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049052 * 3049555: [views] Add CHECK to prevent fallthrough to global NativeTheme Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3049555 * chore: empty commit * chore: fix whitespace for lint * chore: cherry-pick chromium woa fix * Revert "chore: cherry-pick chromium woa fix" This reverts commit 64f3082e2d5f93ef0e2ac5d98246532a105fd4a1. * chore: fix the build on Windows on ARM * chore: remove commented code in printing.patch * fixup! chore: remove commented code in printing.patch do not remove the new weak_ptr check * build: sync disable_use_lld_for_macos.patch Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
86 lines
3.2 KiB
C++
86 lines
3.2 KiB
C++
// Copyright (c) 2019 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_NET_URL_PIPE_LOADER_H_
|
|
#define SHELL_BROWSER_NET_URL_PIPE_LOADER_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/values.h"
|
|
#include "mojo/public/cpp/bindings/receiver.h"
|
|
#include "mojo/public/cpp/bindings/remote.h"
|
|
#include "mojo/public/cpp/system/data_pipe_producer.h"
|
|
#include "services/network/public/cpp/resource_request.h"
|
|
#include "services/network/public/cpp/simple_url_loader.h"
|
|
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
|
|
|
namespace network {
|
|
class SharedURLLoaderFactory;
|
|
}
|
|
|
|
namespace electron {
|
|
|
|
// Read data from URL and pipe it to NetworkService.
|
|
//
|
|
// Different from creating a new loader for the URL directly, protocol handlers
|
|
// using this loader can work around CORS restrictions.
|
|
//
|
|
// This class manages its own lifetime and should delete itself when the
|
|
// connection is lost or finished.
|
|
class URLPipeLoader : public network::mojom::URLLoader,
|
|
public network::SimpleURLLoaderStreamConsumer {
|
|
public:
|
|
URLPipeLoader(scoped_refptr<network::SharedURLLoaderFactory> factory,
|
|
std::unique_ptr<network::ResourceRequest> request,
|
|
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
|
const net::NetworkTrafficAnnotationTag& annotation,
|
|
base::DictionaryValue upload_data);
|
|
|
|
private:
|
|
~URLPipeLoader() override;
|
|
|
|
void Start(scoped_refptr<network::SharedURLLoaderFactory> factory,
|
|
std::unique_ptr<network::ResourceRequest> request,
|
|
const net::NetworkTrafficAnnotationTag& annotation,
|
|
base::DictionaryValue upload_data);
|
|
void NotifyComplete(int result);
|
|
void OnResponseStarted(const GURL& final_url,
|
|
const network::mojom::URLResponseHead& response_head);
|
|
void OnWrite(base::OnceClosure resume, MojoResult result);
|
|
|
|
// SimpleURLLoaderStreamConsumer:
|
|
void OnDataReceived(base::StringPiece string_piece,
|
|
base::OnceClosure resume) override;
|
|
void OnComplete(bool success) override;
|
|
void OnRetry(base::OnceClosure start_retry) override;
|
|
|
|
// URLLoader:
|
|
void FollowRedirect(
|
|
const std::vector<std::string>& removed_headers,
|
|
const net::HttpRequestHeaders& modified_headers,
|
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
|
const absl::optional<GURL>& new_url) override {}
|
|
void SetPriority(net::RequestPriority priority,
|
|
int32_t intra_priority_value) override {}
|
|
void PauseReadingBodyFromNet() override {}
|
|
void ResumeReadingBodyFromNet() override {}
|
|
|
|
mojo::Receiver<network::mojom::URLLoader> url_loader_;
|
|
mojo::Remote<network::mojom::URLLoaderClient> client_;
|
|
|
|
std::unique_ptr<mojo::DataPipeProducer> producer_;
|
|
std::unique_ptr<network::SimpleURLLoader> loader_;
|
|
|
|
base::WeakPtrFactory<URLPipeLoader> weak_factory_{this};
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(URLPipeLoader);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_NET_URL_PIPE_LOADER_H_
|