chore: bump chromium to 63be48daea281d4f8c834c2e707a7 (master) (#19923)
This commit is contained in:
parent
104088b86b
commit
eb2d2264d0
124 changed files with 1736 additions and 1410 deletions
|
@ -396,8 +396,8 @@ std::unique_ptr<SkRegion> BrowserWindow::DraggableRegionsToSkRegion(
|
|||
auto sk_region = std::make_unique<SkRegion>();
|
||||
for (const auto& region : regions) {
|
||||
sk_region->op(
|
||||
region->bounds.x(), region->bounds.y(), region->bounds.right(),
|
||||
region->bounds.bottom(),
|
||||
{region->bounds.x(), region->bounds.y(), region->bounds.right(),
|
||||
region->bounds.bottom()},
|
||||
region->draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
|
||||
}
|
||||
return sk_region;
|
||||
|
|
|
@ -47,7 +47,7 @@ std::vector<gfx::Rect> CalculateNonDraggableRegions(
|
|||
int height) {
|
||||
std::vector<gfx::Rect> result;
|
||||
SkRegion non_draggable;
|
||||
non_draggable.op(0, 0, width, height, SkRegion::kUnion_Op);
|
||||
non_draggable.op({0, 0, width, height}, SkRegion::kUnion_Op);
|
||||
non_draggable.op(*draggable, SkRegion::kDifference_Op);
|
||||
for (SkRegion::Iterator it(non_draggable); !it.done(); it.next()) {
|
||||
result.push_back(gfx::SkIRectToRect(it.rect()));
|
||||
|
|
|
@ -88,8 +88,10 @@ v8::Local<v8::Promise> StopRecording(mate::Arguments* args) {
|
|||
StopTracing(std::move(promise), base::make_optional(path));
|
||||
} else {
|
||||
// use a temporary file.
|
||||
base::PostTaskWithTraitsAndReplyWithResult(
|
||||
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
|
||||
base::PostTaskAndReplyWithResult(
|
||||
FROM_HERE,
|
||||
{base::ThreadPool(), base::MayBlock(),
|
||||
base::TaskPriority::USER_VISIBLE},
|
||||
base::BindOnce(CreateTemporaryFileOnIO),
|
||||
base::BindOnce(StopTracing, std::move(promise)));
|
||||
}
|
||||
|
|
|
@ -135,25 +135,25 @@ void FilterCookies(const base::Value& filter,
|
|||
|
||||
std::string InclusionStatusToString(
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
switch (status) {
|
||||
case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY:
|
||||
return "Failed to create httponly cookie";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY:
|
||||
return "Cannot create a secure cookie from an insecure URL";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE:
|
||||
return "Failed to parse cookie";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN:
|
||||
return "Failed to get cookie domain";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX:
|
||||
return "Failed because the cookie violated prefix rules.";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_NONCOOKIEABLE_SCHEME:
|
||||
return "Cannot set cookie for current scheme";
|
||||
case net::CanonicalCookie::CookieInclusionStatus::INCLUDE:
|
||||
return "";
|
||||
default:
|
||||
return "Setting cookie failed";
|
||||
}
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY))
|
||||
return "Failed to create httponly cookie";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY))
|
||||
return "Cannot create a secure cookie from an insecure URL";
|
||||
if (status.HasExclusionReason(net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_FAILURE_TO_STORE))
|
||||
return "Failed to parse cookie";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN))
|
||||
return "Failed to get cookie domain";
|
||||
if (status.HasExclusionReason(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX))
|
||||
return "Failed because the cookie violated prefix rules.";
|
||||
if (status.HasExclusionReason(net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_NONCOOKIEABLE_SCHEME))
|
||||
return "Cannot set cookie for current scheme";
|
||||
return "Setting cookie failed";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -248,14 +248,18 @@ v8::Local<v8::Promise> Cookies::Set(const base::DictionaryValue& details) {
|
|||
|
||||
GURL url(url_string ? *url_string : "");
|
||||
if (!url.is_valid()) {
|
||||
promise.RejectWithErrorMessage(InclusionStatusToString(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN));
|
||||
promise.RejectWithErrorMessage(
|
||||
InclusionStatusToString(net::CanonicalCookie::CookieInclusionStatus(
|
||||
net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_INVALID_DOMAIN)));
|
||||
return handle;
|
||||
}
|
||||
|
||||
if (!name || name->empty()) {
|
||||
promise.RejectWithErrorMessage(InclusionStatusToString(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE));
|
||||
promise.RejectWithErrorMessage(
|
||||
InclusionStatusToString(net::CanonicalCookie::CookieInclusionStatus(
|
||||
net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_FAILURE_TO_STORE)));
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -264,8 +268,10 @@ v8::Local<v8::Promise> Cookies::Set(const base::DictionaryValue& details) {
|
|||
creation_time, expiration_time, last_access_time, secure, http_only,
|
||||
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT);
|
||||
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
||||
promise.RejectWithErrorMessage(InclusionStatusToString(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE));
|
||||
promise.RejectWithErrorMessage(
|
||||
InclusionStatusToString(net::CanonicalCookie::CookieInclusionStatus(
|
||||
net::CanonicalCookie::CookieInclusionStatus::
|
||||
EXCLUDE_FAILURE_TO_STORE)));
|
||||
return handle;
|
||||
}
|
||||
net::CookieOptions options;
|
||||
|
@ -281,11 +287,10 @@ v8::Local<v8::Promise> Cookies::Set(const base::DictionaryValue& details) {
|
|||
base::BindOnce(
|
||||
[](util::Promise<void*> promise,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
auto errmsg = InclusionStatusToString(status);
|
||||
if (errmsg.empty()) {
|
||||
if (status.IsInclude()) {
|
||||
promise.Resolve();
|
||||
} else {
|
||||
promise.RejectWithErrorMessage(errmsg);
|
||||
promise.RejectWithErrorMessage(InclusionStatusToString(status));
|
||||
}
|
||||
},
|
||||
std::move(promise)));
|
||||
|
|
|
@ -33,7 +33,7 @@ KeyWeakMap<std::string> g_weak_map;
|
|||
class DataPipeReader {
|
||||
public:
|
||||
DataPipeReader(util::Promise<v8::Local<v8::Value>> promise,
|
||||
network::mojom::DataPipeGetterPtr data_pipe_getter)
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_getter)
|
||||
: promise_(std::move(promise)),
|
||||
data_pipe_getter_(std::move(data_pipe_getter)),
|
||||
handle_watcher_(FROM_HERE,
|
||||
|
@ -109,7 +109,7 @@ class DataPipeReader {
|
|||
// Destroy data pipe.
|
||||
handle_watcher_.Cancel();
|
||||
data_pipe_.reset();
|
||||
data_pipe_getter_ = nullptr;
|
||||
data_pipe_getter_.reset();
|
||||
}
|
||||
|
||||
static void FreeBuffer(char* data, void* self) {
|
||||
|
@ -118,7 +118,7 @@ class DataPipeReader {
|
|||
|
||||
util::Promise<v8::Local<v8::Value>> promise_;
|
||||
|
||||
network::mojom::DataPipeGetterPtr data_pipe_getter_;
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_getter_;
|
||||
mojo::ScopedDataPipeConsumerHandle data_pipe_;
|
||||
mojo::SimpleWatcher handle_watcher_;
|
||||
|
||||
|
@ -141,8 +141,9 @@ class DataPipeReader {
|
|||
gin::WrapperInfo DataPipeHolder::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
DataPipeHolder::DataPipeHolder(const network::DataElement& element)
|
||||
: id_(base::NumberToString(++g_next_id)),
|
||||
data_pipe_(element.CloneDataPipeGetter()) {}
|
||||
: id_(base::NumberToString(++g_next_id)) {
|
||||
data_pipe_.Bind(element.CloneDataPipeGetter());
|
||||
}
|
||||
|
||||
DataPipeHolder::~DataPipeHolder() = default;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "gin/handle.h"
|
||||
#include "gin/wrappable.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/network/public/cpp/data_element.h"
|
||||
#include "services/network/public/mojom/data_pipe_getter.mojom.h"
|
||||
|
||||
|
@ -41,7 +42,7 @@ class DataPipeHolder : public gin::Wrappable<DataPipeHolder> {
|
|||
~DataPipeHolder() override;
|
||||
|
||||
std::string id_;
|
||||
network::mojom::DataPipeGetterPtr data_pipe_;
|
||||
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DataPipeHolder);
|
||||
};
|
||||
|
|
|
@ -34,10 +34,9 @@ void NativeTheme::OnNativeThemeUpdatedOnUI() {
|
|||
}
|
||||
|
||||
void NativeTheme::OnNativeThemeUpdated(ui::NativeTheme* theme) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&NativeTheme::OnNativeThemeUpdatedOnUI,
|
||||
base::Unretained(this)));
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&NativeTheme::OnNativeThemeUpdatedOnUI,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void NativeTheme::SetThemeSource(ui::NativeTheme::ThemeSource override) {
|
||||
|
|
|
@ -53,8 +53,8 @@ scoped_refptr<base::SequencedTaskRunner> CreateFileTaskRunner() {
|
|||
//
|
||||
// These operations can be skipped on shutdown since FileNetLogObserver's API
|
||||
// doesn't require things to have completed until notified of completion.
|
||||
return base::CreateSequencedTaskRunnerWithTraits(
|
||||
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
return base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
#include "content/public/browser/download_manager_delegate.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
#include "net/base/completion_repeating_callback.h"
|
||||
|
@ -401,14 +402,16 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
|||
return;
|
||||
}
|
||||
|
||||
network::mojom::CertVerifierClientPtr cert_verifier_client;
|
||||
mojo::PendingRemote<network::mojom::CertVerifierClient>
|
||||
cert_verifier_client_remote;
|
||||
if (proc) {
|
||||
mojo::MakeStrongBinding(std::make_unique<CertVerifierClient>(proc),
|
||||
mojo::MakeRequest(&cert_verifier_client));
|
||||
mojo::MakeSelfOwnedReceiver(
|
||||
std::make_unique<CertVerifierClient>(proc),
|
||||
cert_verifier_client_remote.InitWithNewPipeAndPassReceiver());
|
||||
}
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
|
||||
->GetNetworkContext()
|
||||
->SetCertVerifierClient(std::move(cert_verifier_client));
|
||||
->SetCertVerifierClient(std::move(cert_verifier_client_remote));
|
||||
|
||||
// This causes the cert verifier cache to be cleared.
|
||||
content::GetNetworkService()->OnCertDBChanged();
|
||||
|
@ -637,7 +640,7 @@ void Session::Preconnect(const mate::Dictionary& options,
|
|||
}
|
||||
|
||||
DCHECK_GT(num_sockets_to_preconnect, 0);
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&StartPreconnectOnUI, base::RetainedRef(browser_context_),
|
||||
url, num_sockets_to_preconnect));
|
||||
|
|
|
@ -240,7 +240,7 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
|
|||
|
||||
template <typename... Args>
|
||||
void EmitEventSoon(base::StringPiece eventName) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(base::IgnoreResult(&TopLevelWindow::Emit<Args...>),
|
||||
weak_factory_.GetWeakPtr(), eventName));
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||
#include "mojo/public/cpp/system/string_data_source.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "native_mate/object_template_builder.h"
|
||||
|
@ -112,9 +113,10 @@ class MultipartDataPipeGetter : public UploadDataPipeGetter,
|
|||
~MultipartDataPipeGetter() override = default;
|
||||
|
||||
void AttachToRequestBody(network::ResourceRequestBody* body) override {
|
||||
network::mojom::DataPipeGetterPtr data_pipe_getter;
|
||||
binding_set_.AddBinding(this, mojo::MakeRequest(&data_pipe_getter));
|
||||
body->AppendDataPipe(std::move(data_pipe_getter));
|
||||
mojo::PendingRemote<network::mojom::DataPipeGetter> data_pipe_getter_remote;
|
||||
receivers_.Add(this,
|
||||
data_pipe_getter_remote.InitWithNewPipeAndPassReceiver());
|
||||
body->AppendDataPipe(std::move(data_pipe_getter_remote));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -125,11 +127,12 @@ class MultipartDataPipeGetter : public UploadDataPipeGetter,
|
|||
SetPipe(std::move(pipe));
|
||||
}
|
||||
|
||||
void Clone(network::mojom::DataPipeGetterRequest request) override {
|
||||
binding_set_.AddBinding(this, std::move(request));
|
||||
void Clone(
|
||||
mojo::PendingReceiver<network::mojom::DataPipeGetter> receiver) override {
|
||||
receivers_.Add(this, std::move(receiver));
|
||||
}
|
||||
|
||||
mojo::BindingSet<network::mojom::DataPipeGetter> binding_set_;
|
||||
mojo::ReceiverSet<network::mojom::DataPipeGetter> receivers_;
|
||||
};
|
||||
|
||||
// Streaming chunked data to NetworkService.
|
||||
|
@ -141,9 +144,11 @@ class ChunkedDataPipeGetter : public UploadDataPipeGetter,
|
|||
~ChunkedDataPipeGetter() override = default;
|
||||
|
||||
void AttachToRequestBody(network::ResourceRequestBody* body) override {
|
||||
network::mojom::ChunkedDataPipeGetterPtr data_pipe_getter;
|
||||
binding_set_.AddBinding(this, mojo::MakeRequest(&data_pipe_getter));
|
||||
body->SetToChunkedDataPipe(std::move(data_pipe_getter));
|
||||
mojo::PendingRemote<network::mojom::ChunkedDataPipeGetter>
|
||||
data_pipe_getter_remote;
|
||||
receiver_set_.Add(this,
|
||||
data_pipe_getter_remote.InitWithNewPipeAndPassReceiver());
|
||||
body->SetToChunkedDataPipe(std::move(data_pipe_getter_remote));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -156,7 +161,7 @@ class ChunkedDataPipeGetter : public UploadDataPipeGetter,
|
|||
SetPipe(std::move(pipe));
|
||||
}
|
||||
|
||||
mojo::BindingSet<network::mojom::ChunkedDataPipeGetter> binding_set_;
|
||||
mojo::ReceiverSet<network::mojom::ChunkedDataPipeGetter> receiver_set_;
|
||||
};
|
||||
|
||||
URLRequestNS::URLRequestNS(mate::Arguments* args) : weak_factory_(this) {
|
||||
|
|
|
@ -66,7 +66,8 @@ void GPUInfoManager::CompleteInfoFetcher(
|
|||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
gpu_data_manager_->RequestCompleteGpuInfoIfNeeded();
|
||||
gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(
|
||||
content::kGpuInfoRequestAll, /* delayed */ false);
|
||||
} else {
|
||||
GPUInfoManager::OnGpuInfoUpdate();
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@
|
|||
|
||||
#if BUILDFLAG(ENABLE_TTS)
|
||||
#include "chrome/browser/speech/tts_controller_delegate_impl.h"
|
||||
#include "chrome/browser/speech/tts_message_filter.h"
|
||||
#endif // BUILDFLAG(ENABLE_TTS)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
|
@ -175,7 +174,7 @@ AtomBrowserClient* AtomBrowserClient::Get() {
|
|||
// static
|
||||
void AtomBrowserClient::SetApplicationLocale(const std::string& locale) {
|
||||
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
|
||||
!base::PostTaskWithTraits(
|
||||
!base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
|
||||
g_io_thread_application_locale.Get() = locale;
|
||||
|
@ -353,10 +352,6 @@ void AtomBrowserClient::RenderProcessWillLaunch(
|
|||
process_id, host->GetBrowserContext()));
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_TTS)
|
||||
host->AddFilter(new TtsMessageFilter(host->GetBrowserContext()));
|
||||
#endif
|
||||
|
||||
ProcessPreferences prefs;
|
||||
auto* web_preferences =
|
||||
WebContentsPreferences::From(GetWebContentsFromProcessID(process_id));
|
||||
|
@ -748,13 +743,12 @@ AtomBrowserClient::OverrideSystemLocationProvider() {
|
|||
#endif
|
||||
}
|
||||
|
||||
network::mojom::NetworkContextPtr AtomBrowserClient::CreateNetworkContext(
|
||||
mojo::Remote<network::mojom::NetworkContext>
|
||||
AtomBrowserClient::CreateNetworkContext(
|
||||
content::BrowserContext* browser_context,
|
||||
bool /*in_memory*/,
|
||||
const base::FilePath& /*relative_partition_path*/) {
|
||||
if (!browser_context)
|
||||
return nullptr;
|
||||
|
||||
DCHECK(browser_context);
|
||||
return NetworkContextServiceFactory::GetForContext(browser_context)
|
||||
->CreateNetworkContext();
|
||||
}
|
||||
|
@ -861,10 +855,9 @@ bool AtomBrowserClient::HandleExternalProtocol(
|
|||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
network::mojom::URLLoaderFactoryPtr* out_factory) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&HandleExternalProtocolInUI, url, web_contents_getter,
|
||||
has_user_gesture));
|
||||
base::PostTask(FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&HandleExternalProtocolInUI, url,
|
||||
web_contents_getter, has_user_gesture));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -984,7 +977,8 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory(
|
|||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
api::ProtocolNS* protocol =
|
||||
|
@ -997,14 +991,15 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory(
|
|||
network::mojom::URLLoaderFactoryPtrInfo target_factory_info;
|
||||
*factory_receiver = mojo::MakeRequest(&target_factory_info);
|
||||
|
||||
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request;
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
header_client_receiver;
|
||||
if (header_client)
|
||||
header_client_request = mojo::MakeRequest(header_client);
|
||||
header_client_receiver = header_client->InitWithNewPipeAndPassReceiver();
|
||||
|
||||
new ProxyingURLLoaderFactory(
|
||||
web_request.get(), protocol->intercept_handlers(), render_process_id,
|
||||
std::move(proxied_receiver), std::move(target_factory_info),
|
||||
std::move(header_client_request));
|
||||
std::move(header_client_receiver), type);
|
||||
|
||||
if (bypass_redirect_checks)
|
||||
*bypass_redirect_checks = true;
|
||||
|
@ -1015,7 +1010,8 @@ network::mojom::URLLoaderFactoryPtrInfo
|
|||
AtomBrowserClient::CreateURLLoaderFactoryForNetworkRequests(
|
||||
content::RenderProcessHost* process,
|
||||
network::mojom::NetworkContext* network_context,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
const url::Origin& request_initiator) {
|
||||
auto render_process_id = process->GetID();
|
||||
auto it = process_preferences_.find(render_process_id);
|
||||
|
@ -1039,7 +1035,8 @@ AtomBrowserClient::CreateURLLoaderFactoryForNetworkRequests(
|
|||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool AtomBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
|
||||
bool AtomBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||
RendererSpawnFlags flags) {
|
||||
// Allow crashpad to communicate via named pipe.
|
||||
sandbox::ResultCode result = policy->AddRule(
|
||||
sandbox::TargetPolicy::SUBSYS_FILES,
|
||||
|
|
|
@ -143,7 +143,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
content::ResourceContext* resource_context) override;
|
||||
std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider()
|
||||
override;
|
||||
network::mojom::NetworkContextPtr CreateNetworkContext(
|
||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(
|
||||
content::BrowserContext* browser_context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) override;
|
||||
|
@ -177,16 +177,19 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks) override;
|
||||
network::mojom::URLLoaderFactoryPtrInfo
|
||||
CreateURLLoaderFactoryForNetworkRequests(
|
||||
content::RenderProcessHost* process,
|
||||
network::mojom::NetworkContext* network_context,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
const url::Origin& request_initiator) override;
|
||||
#if defined(OS_WIN)
|
||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
|
||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||
RendererSpawnFlags flags) override;
|
||||
#endif
|
||||
bool BindAssociatedInterfaceRequestFromFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
|
|
@ -275,7 +275,8 @@ AtomBrowserContext::GetURLLoaderFactory() {
|
|||
mojo::MakeRequest(&network_factory);
|
||||
|
||||
// Consult the embedder.
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo header_client;
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
header_client;
|
||||
static_cast<content::ContentBrowserClient*>(AtomBrowserClient::Get())
|
||||
->WillCreateURLLoaderFactory(
|
||||
this, nullptr, -1,
|
||||
|
|
|
@ -137,7 +137,7 @@ void ShutdownDetector::ThreadMain() {
|
|||
} while (bytes_read < sizeof(signal));
|
||||
VLOG(1) << "Handling shutdown for signal " << signal << ".";
|
||||
|
||||
if (!base::PostTaskWithTraits(
|
||||
if (!base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&Browser::Quit, base::Unretained(Browser::Get())))) {
|
||||
// Without a UI thread to post the exit task to, there aren't many
|
||||
|
|
|
@ -216,9 +216,9 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
base::FilePath default_download_path =
|
||||
browser_context->prefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
|
||||
|
||||
base::PostTaskWithTraitsAndReplyWithResult(
|
||||
base::PostTaskAndReplyWithResult(
|
||||
FROM_HERE,
|
||||
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
||||
base::BindOnce(&CreateDownloadPath, download->GetURL(),
|
||||
download->GetContentDisposition(),
|
||||
|
|
|
@ -178,8 +178,8 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents,
|
|||
|
||||
CommonWebContentsDelegate::CommonWebContentsDelegate()
|
||||
: devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
||||
file_task_runner_(
|
||||
base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})),
|
||||
file_task_runner_(base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock()})),
|
||||
weak_factory_(this) {}
|
||||
|
||||
CommonWebContentsDelegate::~CommonWebContentsDelegate() = default;
|
||||
|
|
|
@ -131,7 +131,7 @@ AppSorting* AtomExtensionSystem::app_sorting() {
|
|||
void AtomExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
const base::Closure& callback) {
|
||||
base::PostTaskWithTraitsAndReply(
|
||||
base::PostTaskAndReply(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::Bind(&InfoMap::AddExtension, info_map(),
|
||||
base::RetainedRef(extension), base::Time::Now(), false, false),
|
||||
|
|
|
@ -235,7 +235,7 @@ void AtomExtensionsBrowserClient::BroadcastEventToRenderers(
|
|||
const std::string& event_name,
|
||||
std::unique_ptr<base::ListValue> args) {
|
||||
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&AtomExtensionsBrowserClient::BroadcastEventToRenderers,
|
||||
base::Unretained(this), histogram_value, event_name,
|
||||
|
|
|
@ -22,11 +22,11 @@ namespace electron {
|
|||
|
||||
LoginHandler::LoginHandler(net::URLRequest* request,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
net::NetworkDelegate::AuthCallback callback,
|
||||
// net::NetworkDelegate::AuthCallback callback,
|
||||
net::AuthCredentials* credentials)
|
||||
: credentials_(credentials),
|
||||
auth_info_(std::make_unique<net::AuthChallengeInfo>(auth_info)),
|
||||
auth_callback_(std::move(callback)),
|
||||
// auth_callback_(std::move(callback)),
|
||||
weak_factory_(this) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
|
@ -40,7 +40,7 @@ LoginHandler::LoginHandler(net::URLRequest* request,
|
|||
// web_contents_getter_ =
|
||||
// resource_request_info->GetWebContentsGetterForRequest();
|
||||
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::UI},
|
||||
base::BindOnce(&Browser::RequestLogin, base::Unretained(Browser::Get()),
|
||||
base::RetainedRef(this), std::move(request_details)));
|
||||
|
@ -52,7 +52,7 @@ void LoginHandler::Login(const base::string16& username,
|
|||
const base::string16& password) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&LoginHandler::DoLogin, weak_factory_.GetWeakPtr(),
|
||||
username, password));
|
||||
|
@ -61,13 +61,13 @@ void LoginHandler::Login(const base::string16& username,
|
|||
void LoginHandler::CancelAuth() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&LoginHandler::DoCancelAuth, weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void LoginHandler::NotifyRequestDestroyed() {
|
||||
auth_callback_.Reset();
|
||||
// auth_callback_.Reset();
|
||||
credentials_ = nullptr;
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
}
|
||||
|
@ -82,19 +82,23 @@ content::WebContents* LoginHandler::GetWebContents() const {
|
|||
|
||||
void LoginHandler::DoCancelAuth() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
/*
|
||||
if (!auth_callback_.is_null())
|
||||
std::move(auth_callback_)
|
||||
.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH);
|
||||
*/
|
||||
}
|
||||
|
||||
void LoginHandler::DoLogin(const base::string16& username,
|
||||
const base::string16& password) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
/*
|
||||
if (!auth_callback_.is_null()) {
|
||||
credentials_->Set(username, password);
|
||||
std::move(auth_callback_)
|
||||
.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -26,7 +26,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
|
|||
public:
|
||||
LoginHandler(net::URLRequest* request,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
net::NetworkDelegate::AuthCallback callback,
|
||||
// net::NetworkDelegate::AuthCallback callback,
|
||||
net::AuthCredentials* credentials);
|
||||
|
||||
// The auth is cancelled, must be called on UI thread.
|
||||
|
@ -64,7 +64,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
|
|||
content::WebContents::Getter web_contents_getter_;
|
||||
|
||||
// Called with preferred value of net::NetworkDelegate::AuthRequiredResponse.
|
||||
net::NetworkDelegate::AuthCallback auth_callback_;
|
||||
// net::NetworkDelegate::AuthCallback auth_callback_;
|
||||
|
||||
base::WeakPtrFactory<LoginHandler> weak_factory_;
|
||||
|
||||
|
|
|
@ -122,9 +122,8 @@
|
|||
*/
|
||||
- (void)runCallback:(bool)isProductValid {
|
||||
if (callback_) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(std::move(callback_), isProductValid));
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(std::move(callback_), isProductValid));
|
||||
}
|
||||
// Release this delegate.
|
||||
[self release];
|
||||
|
|
|
@ -75,8 +75,8 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
|||
}
|
||||
|
||||
// Send the callback to the browser thread.
|
||||
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(callback_, converted));
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(callback_, converted));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,8 +83,8 @@
|
|||
}
|
||||
|
||||
// Send the callback to the browser thread.
|
||||
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(std::move(callback_), converted));
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(std::move(callback_), converted));
|
||||
|
||||
[self release];
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
|
|||
if (has_frame()) {
|
||||
// TODO(zcbenz): This was used to force using native frame on Windows 2003,
|
||||
// we should check whether setting it in InitParams can work.
|
||||
widget()->set_frame_type(views::Widget::FrameType::FRAME_TYPE_FORCE_NATIVE);
|
||||
widget()->set_frame_type(views::Widget::FrameType::kForceNative);
|
||||
widget()->FrameTypeChanged();
|
||||
#if defined(OS_WIN)
|
||||
// thickFrame also works for normal window.
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "net/base/mime_util.h"
|
||||
#include "net/http/http_byte_range.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "shell/common/asar/archive.h"
|
||||
#include "shell/common/asar/asar_util.h"
|
||||
|
||||
|
@ -298,8 +299,8 @@ void CreateAsarURLLoader(
|
|||
network::mojom::URLLoaderRequest loader,
|
||||
network::mojom::URLLoaderClientPtr client,
|
||||
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
|
||||
auto task_runner = base::CreateSequencedTaskRunnerWithTraits(
|
||||
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
auto task_runner = base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
|
||||
task_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(&AsarURLLoader::CreateAndStart, request,
|
||||
|
|
|
@ -19,12 +19,12 @@ NetworkContextService::NetworkContextService(content::BrowserContext* context)
|
|||
|
||||
NetworkContextService::~NetworkContextService() = default;
|
||||
|
||||
network::mojom::NetworkContextPtr
|
||||
mojo::Remote<network::mojom::NetworkContext>
|
||||
NetworkContextService::CreateNetworkContext() {
|
||||
network::mojom::NetworkContextPtr network_context;
|
||||
mojo::Remote<network::mojom::NetworkContext> network_context;
|
||||
|
||||
content::GetNetworkService()->CreateNetworkContext(
|
||||
MakeRequest(&network_context),
|
||||
network_context.BindNewPipeAndPassReceiver(),
|
||||
CreateNetworkContextParams(browser_context_->IsOffTheRecord(),
|
||||
browser_context_->GetPath()));
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "base/files/file_path.h"
|
||||
#include "chrome/browser/net/proxy_config_monitor.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "shell/browser/atom_browser_context.h"
|
||||
|
||||
|
@ -24,7 +25,7 @@ class NetworkContextService : public KeyedService {
|
|||
NetworkContextService& operator=(const NetworkContextService&) = delete;
|
||||
|
||||
// Creates a NetworkContext for the BrowserContext.
|
||||
network::mojom::NetworkContextPtr CreateNetworkContext();
|
||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext();
|
||||
|
||||
private:
|
||||
// Creates parameters for the NetworkContext.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||
#include "mojo/public/cpp/system/data_pipe_producer.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ ProxyingURLLoaderFactory::InProgressRequest::InProgressRequest(
|
|||
proxied_client_binding_(this),
|
||||
// TODO(zcbenz): We should always use "extraHeaders" mode to be compatible
|
||||
// with old APIs.
|
||||
has_any_extra_headers_listeners_(false),
|
||||
header_client_binding_(this) {
|
||||
has_any_extra_headers_listeners_(false) {
|
||||
// If there is a client error, clean up the request.
|
||||
target_client_.set_connection_error_handler(base::BindOnce(
|
||||
&ProxyingURLLoaderFactory::InProgressRequest::OnRequestError,
|
||||
|
@ -78,10 +77,11 @@ void ProxyingURLLoaderFactory::InProgressRequest::UpdateRequestInfo() {
|
|||
info_.emplace(extensions::WebRequestInfoInitParams(
|
||||
request_id_, factory_->render_process_id_, request_.render_frame_id,
|
||||
nullptr, routing_id_, request_for_info, false,
|
||||
!(options_ & network::mojom::kURLLoadOptionSynchronous)));
|
||||
!(options_ & network::mojom::kURLLoadOptionSynchronous),
|
||||
factory_->IsForServiceWorkerScript()));
|
||||
|
||||
current_request_uses_header_client_ =
|
||||
factory_->url_loader_header_client_binding_ &&
|
||||
factory_->url_loader_header_client_receiver_.is_bound() &&
|
||||
network_service_request_id_ != 0 &&
|
||||
false /* TODO(zcbenz): HasExtraHeadersListenerForRequest */;
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::RestartInternal() {
|
|||
|
||||
// Pause the header client, since we want to wait until OnBeforeRequest has
|
||||
// finished before processing any future events.
|
||||
if (header_client_binding_)
|
||||
header_client_binding_.PauseIncomingMethodCallProcessing();
|
||||
if (header_client_receiver_.is_bound())
|
||||
header_client_receiver_.Pause();
|
||||
return;
|
||||
}
|
||||
DCHECK_EQ(net::OK, result);
|
||||
|
@ -188,7 +188,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ResumeReadingBodyFromNet() {
|
|||
}
|
||||
|
||||
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
||||
const network::ResourceResponseHead& head) {
|
||||
network::mojom::URLResponseHeadPtr head) {
|
||||
if (current_request_uses_header_client_) {
|
||||
// Use the headers we got from OnHeadersReceived as that'll contain
|
||||
// Set-Cookie if it existed.
|
||||
|
@ -206,7 +206,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
|||
|
||||
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveRedirect(
|
||||
const net::RedirectInfo& redirect_info,
|
||||
const network::ResourceResponseHead& head) {
|
||||
network::mojom::URLResponseHeadPtr head) {
|
||||
// Note: In Electron we don't check IsRedirectSafe.
|
||||
|
||||
if (current_request_uses_header_client_) {
|
||||
|
@ -267,8 +267,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnComplete(
|
|||
}
|
||||
|
||||
void ProxyingURLLoaderFactory::InProgressRequest::OnLoaderCreated(
|
||||
network::mojom::TrustedHeaderClientRequest request) {
|
||||
header_client_binding_.Bind(std::move(request));
|
||||
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
|
||||
header_client_receiver_.Bind(std::move(receiver));
|
||||
}
|
||||
|
||||
void ProxyingURLLoaderFactory::InProgressRequest::OnBeforeSendHeaders(
|
||||
|
@ -408,8 +408,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToStartRequest(
|
|||
if (proxied_client_binding_.is_bound())
|
||||
proxied_client_binding_.ResumeIncomingMethodCallProcessing();
|
||||
|
||||
if (header_client_binding_)
|
||||
header_client_binding_.ResumeIncomingMethodCallProcessing();
|
||||
if (header_client_receiver_.is_bound())
|
||||
header_client_receiver_.Resume();
|
||||
|
||||
if (!target_loader_.is_bound() && factory_->target_factory_.is_bound()) {
|
||||
// No extensions have cancelled us up to this point, so it's now OK to
|
||||
|
@ -429,7 +429,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToStartRequest(
|
|||
|
||||
// From here the lifecycle of this request is driven by subsequent events on
|
||||
// either |proxy_loader_binding_|, |proxy_client_binding_|, or
|
||||
// |header_client_binding_|.
|
||||
// |header_client_receiver_|.
|
||||
}
|
||||
|
||||
void ProxyingURLLoaderFactory::InProgressRequest::
|
||||
|
@ -489,7 +489,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToResponseStarted(
|
|||
// These will get re-bound if a new request is initiated by
|
||||
// |FollowRedirect()|.
|
||||
proxied_client_binding_.Close();
|
||||
header_client_binding_.Close();
|
||||
header_client_receiver_.reset();
|
||||
target_loader_.reset();
|
||||
|
||||
ContinueToBeforeRedirect(redirect_info, net::OK);
|
||||
|
@ -546,7 +546,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::
|
|||
// the load with it gives unexpected results. See
|
||||
// https://crbug.com/882661#c72.
|
||||
proxied_client_binding_.Close();
|
||||
header_client_binding_.Close();
|
||||
header_client_receiver_.reset();
|
||||
target_loader_.reset();
|
||||
|
||||
constexpr int kInternalRedirectStatusCode = 307;
|
||||
|
@ -654,11 +654,13 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
int render_process_id,
|
||||
network::mojom::URLLoaderFactoryRequest loader_request,
|
||||
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
|
||||
network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request)
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
header_client_receiver,
|
||||
content::ContentBrowserClient::URLLoaderFactoryType loader_factory_type)
|
||||
: web_request_api_(web_request_api),
|
||||
intercepted_handlers_(intercepted_handlers),
|
||||
render_process_id_(render_process_id),
|
||||
url_loader_header_client_binding_(this) {
|
||||
loader_factory_type_(loader_factory_type) {
|
||||
target_factory_.Bind(std::move(target_factory_info));
|
||||
target_factory_.set_connection_error_handler(base::BindOnce(
|
||||
&ProxyingURLLoaderFactory::OnTargetFactoryError, base::Unretained(this)));
|
||||
|
@ -666,8 +668,8 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
proxy_bindings_.set_connection_error_handler(base::BindRepeating(
|
||||
&ProxyingURLLoaderFactory::OnProxyBindingError, base::Unretained(this)));
|
||||
|
||||
if (header_client_request)
|
||||
url_loader_header_client_binding_.Bind(std::move(header_client_request));
|
||||
if (header_client_receiver)
|
||||
url_loader_header_client_receiver_.Bind(std::move(header_client_receiver));
|
||||
}
|
||||
|
||||
ProxyingURLLoaderFactory::~ProxyingURLLoaderFactory() = default;
|
||||
|
@ -731,14 +733,19 @@ void ProxyingURLLoaderFactory::Clone(
|
|||
|
||||
void ProxyingURLLoaderFactory::OnLoaderCreated(
|
||||
int32_t request_id,
|
||||
network::mojom::TrustedHeaderClientRequest request) {
|
||||
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
|
||||
auto it = network_request_id_to_web_request_id_.find(request_id);
|
||||
if (it == network_request_id_to_web_request_id_.end())
|
||||
return;
|
||||
|
||||
auto request_it = requests_.find(it->second);
|
||||
DCHECK(request_it != requests_.end());
|
||||
request_it->second->OnLoaderCreated(std::move(request));
|
||||
request_it->second->OnLoaderCreated(std::move(receiver));
|
||||
}
|
||||
|
||||
bool ProxyingURLLoaderFactory::IsForServiceWorkerScript() const {
|
||||
return loader_factory_type_ == content::ContentBrowserClient::
|
||||
URLLoaderFactoryType::kServiceWorkerScript;
|
||||
}
|
||||
|
||||
void ProxyingURLLoaderFactory::OnTargetFactoryError() {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <vector>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "extensions/browser/api/web_request/web_request_info.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
|
@ -101,9 +103,9 @@ class ProxyingURLLoaderFactory
|
|||
void ResumeReadingBodyFromNet() override;
|
||||
|
||||
// network::mojom::URLLoaderClient:
|
||||
void OnReceiveResponse(const network::ResourceResponseHead& head) override;
|
||||
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
|
||||
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
||||
const network::ResourceResponseHead& head) override;
|
||||
network::mojom::URLResponseHeadPtr head) override;
|
||||
void OnUploadProgress(int64_t current_position,
|
||||
int64_t total_size,
|
||||
OnUploadProgressCallback callback) override;
|
||||
|
@ -113,7 +115,8 @@ class ProxyingURLLoaderFactory
|
|||
mojo::ScopedDataPipeConsumerHandle body) override;
|
||||
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
|
||||
|
||||
void OnLoaderCreated(network::mojom::TrustedHeaderClientRequest request);
|
||||
void OnLoaderCreated(
|
||||
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver);
|
||||
|
||||
// network::mojom::TrustedHeaderClient:
|
||||
void OnBeforeSendHeaders(const net::HttpRequestHeaders& headers,
|
||||
|
@ -172,7 +175,8 @@ class ProxyingURLLoaderFactory
|
|||
bool current_request_uses_header_client_ = false;
|
||||
OnBeforeSendHeadersCallback on_before_send_headers_callback_;
|
||||
OnHeadersReceivedCallback on_headers_received_callback_;
|
||||
mojo::Binding<network::mojom::TrustedHeaderClient> header_client_binding_;
|
||||
mojo::Receiver<network::mojom::TrustedHeaderClient> header_client_receiver_{
|
||||
this};
|
||||
|
||||
// If |has_any_extra_headers_listeners_| is set to false and a redirect is
|
||||
// in progress, this stores the parameters to FollowRedirect that came from
|
||||
|
@ -200,8 +204,9 @@ class ProxyingURLLoaderFactory
|
|||
int render_process_id,
|
||||
network::mojom::URLLoaderFactoryRequest loader_request,
|
||||
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
|
||||
network::mojom::TrustedURLLoaderHeaderClientRequest
|
||||
header_client_request);
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
header_client_receiver,
|
||||
content::ContentBrowserClient::URLLoaderFactoryType loader_factory_type);
|
||||
~ProxyingURLLoaderFactory() override;
|
||||
|
||||
// network::mojom::URLLoaderFactory:
|
||||
|
@ -218,10 +223,13 @@ class ProxyingURLLoaderFactory
|
|||
// network::mojom::TrustedURLLoaderHeaderClient:
|
||||
void OnLoaderCreated(
|
||||
int32_t request_id,
|
||||
network::mojom::TrustedHeaderClientRequest request) override;
|
||||
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver)
|
||||
override;
|
||||
|
||||
WebRequestAPI* web_request_api() { return web_request_api_; }
|
||||
|
||||
bool IsForServiceWorkerScript() const;
|
||||
|
||||
private:
|
||||
void OnTargetFactoryError();
|
||||
void OnProxyBindingError();
|
||||
|
@ -243,8 +251,10 @@ class ProxyingURLLoaderFactory
|
|||
const int render_process_id_;
|
||||
mojo::BindingSet<network::mojom::URLLoaderFactory> proxy_bindings_;
|
||||
network::mojom::URLLoaderFactoryPtr target_factory_;
|
||||
mojo::Binding<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
url_loader_header_client_binding_;
|
||||
mojo::Receiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
url_loader_header_client_receiver_{this};
|
||||
const content::ContentBrowserClient::URLLoaderFactoryType
|
||||
loader_factory_type_;
|
||||
|
||||
// Mapping from our own internally generated request ID to an
|
||||
// InProgressRequest instance.
|
||||
|
|
|
@ -111,7 +111,7 @@ class SystemNetworkContextManager::URLLoaderFactoryForSystem
|
|||
};
|
||||
|
||||
network::mojom::NetworkContext* SystemNetworkContextManager::GetContext() {
|
||||
if (!network_context_ || network_context_.encountered_error()) {
|
||||
if (!network_context_ || !network_context_.is_connected()) {
|
||||
// This should call into OnNetworkServiceCreated(), which will re-create
|
||||
// the network service, if needed. There's a chance that it won't be
|
||||
// invoked, if the NetworkContext has encountered an error but the
|
||||
|
@ -201,8 +201,10 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(
|
|||
|
||||
// The system NetworkContext must be created first, since it sets
|
||||
// |primary_network_context| to true.
|
||||
network_service->CreateNetworkContext(MakeRequest(&network_context_),
|
||||
CreateNetworkContextParams());
|
||||
network_context_.reset();
|
||||
network_service->CreateNetworkContext(
|
||||
network_context_.BindNewPipeAndPassReceiver(),
|
||||
CreateNetworkContextParams());
|
||||
}
|
||||
|
||||
network::mojom::NetworkContextParamsPtr
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "base/memory/ref_counted.h"
|
||||
#include "base/optional.h"
|
||||
#include "chrome/browser/net/proxy_config_monitor.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/network_service.mojom.h"
|
||||
|
||||
|
@ -91,7 +92,7 @@ class SystemNetworkContextManager {
|
|||
|
||||
// NetworkContext using the network service, if the network service is
|
||||
// enabled. nullptr, otherwise.
|
||||
network::mojom::NetworkContextPtr network_context_;
|
||||
mojo::Remote<network::mojom::NetworkContext> network_context_;
|
||||
|
||||
// URLLoaderFactory backed by the NetworkContext returned by GetContext(), so
|
||||
// consumers don't all need to create their own factory.
|
||||
|
|
|
@ -413,7 +413,7 @@ ToastEventHandler::~ToastEventHandler() {}
|
|||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
IInspectable* args) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&Notification::NotificationClicked, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
|
@ -425,7 +425,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&Notification::NotificationDismissed, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
|
@ -437,7 +437,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
|
|||
IFACEMETHODIMP ToastEventHandler::Invoke(
|
||||
ABI::Windows::UI::Notifications::IToastNotification* sender,
|
||||
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&Notification::NotificationFailed, notification_));
|
||||
if (IsDebuggingNotifications())
|
||||
|
|
|
@ -127,9 +127,7 @@ class AtomBeginFrameTimer : public viz::DelayBasedTimeSourceClient {
|
|||
const base::Closure& callback)
|
||||
: callback_(callback) {
|
||||
time_source_ = std::make_unique<viz::DelayBasedTimeSource>(
|
||||
base::CreateSingleThreadTaskRunnerWithTraits(
|
||||
{content::BrowserThread::UI})
|
||||
.get());
|
||||
base::CreateSingleThreadTaskRunner({content::BrowserThread::UI}).get());
|
||||
time_source_->SetTimebaseAndInterval(
|
||||
base::TimeTicks(),
|
||||
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us));
|
||||
|
@ -254,7 +252,7 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
|
|||
context_factory_private->AllocateFrameSinkId(),
|
||||
content::GetContextFactory(), context_factory_private,
|
||||
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
|
||||
this);
|
||||
false /* use_external_begin_frame_control */);
|
||||
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
|
||||
compositor_->SetRootLayer(root_layer_.get());
|
||||
|
||||
|
@ -319,16 +317,8 @@ void OffScreenRenderWidgetHostView::SendBeginFrame(
|
|||
begin_frame_number_++;
|
||||
|
||||
compositor_->context_factory_private()->IssueExternalBeginFrame(
|
||||
compositor_.get(), begin_frame_args);
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::OnDisplayDidFinishFrame(
|
||||
const viz::BeginFrameAck& ack) {}
|
||||
|
||||
void OffScreenRenderWidgetHostView::OnNeedsExternalBeginFrames(
|
||||
bool needs_begin_frames) {
|
||||
SetupFrameRate(true);
|
||||
begin_frame_timer_->SetActive(needs_begin_frames);
|
||||
compositor_.get(), begin_frame_args, /* force */ true,
|
||||
base::NullCallback());
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
|
||||
|
@ -448,7 +438,8 @@ gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
|
|||
|
||||
void OffScreenRenderWidgetHostView::SetInsets(const gfx::Insets& insets) {}
|
||||
|
||||
bool OffScreenRenderWidgetHostView::LockMouse() {
|
||||
bool OffScreenRenderWidgetHostView::LockMouse(
|
||||
bool request_unadjusted_movement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -848,7 +839,7 @@ void OffScreenRenderWidgetHostView::ReleaseResize() {
|
|||
hold_resize_ = false;
|
||||
if (pending_resize_) {
|
||||
pending_resize_ = false;
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(
|
||||
&OffScreenRenderWidgetHostView::SynchronizeVisualProperties,
|
||||
|
@ -953,7 +944,7 @@ void OffScreenRenderWidgetHostView::SendMouseWheelEvent(
|
|||
// Scrolling outside of the popup widget so destroy it.
|
||||
// Execute asynchronously to avoid deleting the widget from inside some
|
||||
// other callback.
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&OffScreenRenderWidgetHostView::CancelWidget,
|
||||
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
#include "components/viz/host/host_display_client.h"
|
||||
#include "ui/compositor/external_begin_frame_client.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/gfx/win/window_impl.h"
|
||||
|
@ -60,7 +59,6 @@ typedef base::Callback<void(const gfx::Rect&, const SkBitmap&)> OnPaintCallback;
|
|||
typedef base::Callback<void(const gfx::Rect&)> OnPopupPaintCallback;
|
||||
|
||||
class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||
public ui::ExternalBeginFrameClient,
|
||||
public ui::CompositorDelegate,
|
||||
public OffscreenViewProxyObserver {
|
||||
public:
|
||||
|
@ -77,9 +75,6 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
content::BrowserAccessibilityDelegate*,
|
||||
bool) override;
|
||||
|
||||
void OnDisplayDidFinishFrame(const viz::BeginFrameAck& ack) override;
|
||||
void OnNeedsExternalBeginFrames(bool needs_begin_frames) override;
|
||||
|
||||
// content::RenderWidgetHostView:
|
||||
void InitAsChild(gfx::NativeView) override;
|
||||
void SetSize(const gfx::Size&) override;
|
||||
|
@ -101,7 +96,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
void SetBackgroundColor(SkColor color) override;
|
||||
base::Optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
bool LockMouse(void) override;
|
||||
bool LockMouse(bool request_unadjusted_movement) override;
|
||||
void UnlockMouse(void) override;
|
||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||
void SetNeedsBeginFrames(bool needs_begin_frames) override;
|
||||
|
|
|
@ -109,8 +109,7 @@ gfx::Rect OffScreenWebContentsView::GetViewBounds() const {
|
|||
return GetView() ? GetView()->GetViewBounds() : gfx::Rect();
|
||||
}
|
||||
|
||||
void OffScreenWebContentsView::CreateView(const gfx::Size& initial_size,
|
||||
gfx::NativeView context) {}
|
||||
void OffScreenWebContentsView::CreateView(gfx::NativeView context) {}
|
||||
|
||||
content::RenderWidgetHostViewBase*
|
||||
OffScreenWebContentsView::CreateViewForWidget(
|
||||
|
|
|
@ -52,8 +52,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
|||
void FocusThroughTabTraversal(bool reverse) override;
|
||||
content::DropData* GetDropData() const override;
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void CreateView(const gfx::Size& initial_size,
|
||||
gfx::NativeView context) override;
|
||||
void CreateView(gfx::NativeView context) override;
|
||||
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
bool is_guest_view_hack) override;
|
||||
|
|
|
@ -41,9 +41,9 @@ void StopWorker(int document_cookie) {
|
|||
std::unique_ptr<printing::PrinterQuery> printer_query =
|
||||
queue->PopPrinterQuery(document_cookie);
|
||||
if (printer_query.get()) {
|
||||
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&printing::PrinterQuery::StopWorker,
|
||||
std::move(printer_query)));
|
||||
base::PostTask(FROM_HERE, {BrowserThread::IO},
|
||||
base::BindOnce(&printing::PrinterQuery::StopWorker,
|
||||
std::move(printer_query)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "shell/browser/session_preferences.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
// static
|
||||
|
|
|
@ -151,7 +151,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
|||
isMenuOpen_ = NO;
|
||||
model_->MenuWillClose();
|
||||
if (!closeCallback.is_null()) {
|
||||
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||
base::PostTask(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
|||
// Post async task so that itemSelected runs before the close callback
|
||||
// deletes the controller from the map which deallocates it
|
||||
if (!closeCallback.is_null()) {
|
||||
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||
base::PostTask(FROM_HERE, {BrowserThread::UI}, closeCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ void RunMessageBoxInNewThread(base::Thread* thread,
|
|||
const MessageBoxSettings& settings,
|
||||
MessageBoxCallback callback) {
|
||||
int result = ShowTaskDialogUTF8(settings);
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(std::move(callback), result, settings.checkbox_checked));
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE,
|
||||
|
|
|
@ -301,7 +301,7 @@ void TrayIconCocoa::PopUpOnUI(AtomMenuModel* menu_model) {
|
|||
|
||||
void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos,
|
||||
AtomMenuModel* menu_model) {
|
||||
base::PostTaskWithTraits(
|
||||
base::PostTask(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&TrayIconCocoa::PopUpOnUI, weak_factory_.GetWeakPtr(),
|
||||
base::Unretained(menu_model)));
|
||||
|
|
|
@ -131,10 +131,9 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
|
|||
button_to_open_ = button;
|
||||
// Switching menu asyncnously to avoid crash.
|
||||
if (!switch_in_progress) {
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&views::MenuRunner::Cancel,
|
||||
base::Unretained(menu_runner_.get())));
|
||||
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&views::MenuRunner::Cancel,
|
||||
base::Unretained(menu_runner_.get())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,6 @@ content::WebContents* WebViewGuestDelegate::CreateNewGuestWindow(
|
|||
// Code below mirrors what content::WebContentsImpl::CreateNewWindow
|
||||
// does for non-guest sources
|
||||
content::WebContents::CreateParams guest_params(create_params);
|
||||
guest_params.initial_size =
|
||||
embedder_web_contents_->GetContainerBounds().size();
|
||||
guest_params.context = embedder_web_contents_->GetNativeView();
|
||||
std::unique_ptr<content::WebContents> guest_contents =
|
||||
content::WebContents::Create(guest_params);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue