chore: bump chromium to 94cc24d3bb17a7406ba6c6cc6dc29 (master) (#21485)

This commit is contained in:
Electron Bot 2019-12-13 15:13:12 -05:00 committed by Jeremy Apthorp
parent 19cd8f3a02
commit 0f2f9a580a
47 changed files with 285 additions and 256 deletions

View file

@ -87,7 +87,7 @@ void AtomDownloadManagerDelegate::GetItemSaveDialogOptions(
void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
uint32_t download_id,
const content::DownloadTargetCallback& callback,
content::DownloadTargetCallback callback,
const base::FilePath& default_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::ThreadRestrictions::ScopedAllowIO allow_io;
@ -125,22 +125,23 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
v8::Isolate* isolate = v8::Isolate::GetCurrent();
gin_helper::Promise<gin_helper::Dictionary> dialog_promise(isolate);
auto dialog_callback =
base::BindOnce(&AtomDownloadManagerDelegate::OnDownloadSaveDialogDone,
base::Unretained(this), download_id, callback);
auto dialog_callback = base::BindOnce(
&AtomDownloadManagerDelegate::OnDownloadSaveDialogDone,
base::Unretained(this), download_id, std::move(callback));
ignore_result(dialog_promise.Then(std::move(dialog_callback)));
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
} else {
callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
std::move(callback).Run(path,
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
}
}
void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
content::DownloadTargetCallback download_callback,
gin_helper::Dictionary result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@ -177,9 +178,10 @@ void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
const auto interrupt_reason =
path.empty() ? download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED
: download::DOWNLOAD_INTERRUPT_REASON_NONE;
download_callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
interrupt_reason);
std::move(download_callback)
.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
interrupt_reason);
}
void AtomDownloadManagerDelegate::Shutdown() {
@ -189,15 +191,16 @@ void AtomDownloadManagerDelegate::Shutdown() {
bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
download::DownloadItem* download,
const content::DownloadTargetCallback& callback) {
content::DownloadTargetCallback* callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!download->GetForcedFilePath().empty()) {
callback.Run(download->GetForcedFilePath(),
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download->GetForcedFilePath(),
download::DOWNLOAD_INTERRUPT_REASON_NONE);
std::move(*callback).Run(
download->GetForcedFilePath(),
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download->GetForcedFilePath(),
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@ -205,10 +208,10 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
base::FilePath save_path;
GetItemSavePath(download, &save_path);
if (!save_path.empty()) {
callback.Run(save_path,
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, save_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
std::move(*callback).Run(
save_path, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, save_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@ -227,20 +230,20 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
default_download_path),
base::BindOnce(&AtomDownloadManagerDelegate::OnDownloadPathGenerated,
weak_ptr_factory_.GetWeakPtr(), download->GetId(),
callback));
std::move(*callback)));
return true;
}
bool AtomDownloadManagerDelegate::ShouldOpenDownload(
download::DownloadItem* download,
const content::DownloadOpenDelayedCallback& callback) {
content::DownloadOpenDelayedCallback callback) {
return true;
}
void AtomDownloadManagerDelegate::GetNextId(
const content::DownloadIdCallback& callback) {
content::DownloadIdCallback callback) {
static uint32_t next_id = download::DownloadItem::kInvalidId + 1;
callback.Run(next_id++);
std::move(callback).Run(next_id++);
}
} // namespace electron

View file

@ -30,11 +30,11 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
void Shutdown() override;
bool DetermineDownloadTarget(
download::DownloadItem* download,
const content::DownloadTargetCallback& callback) override;
content::DownloadTargetCallback* callback) override;
bool ShouldOpenDownload(
download::DownloadItem* download,
const content::DownloadOpenDelayedCallback& callback) override;
void GetNextId(const content::DownloadIdCallback& callback) override;
content::DownloadOpenDelayedCallback callback) override;
void GetNextId(content::DownloadIdCallback callback) override;
private:
// Get the save path set on the associated api::DownloadItem object
@ -43,12 +43,12 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
file_dialog::DialogSettings* settings);
void OnDownloadPathGenerated(uint32_t download_id,
const content::DownloadTargetCallback& callback,
content::DownloadTargetCallback callback,
const base::FilePath& default_path);
void OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
content::DownloadTargetCallback download_callback,
gin_helper::Dictionary result);
content::DownloadManager* download_manager_;

View file

@ -4,6 +4,8 @@
#include "shell/browser/atom_quota_permission_context.h"
#include <utility>
namespace electron {
AtomQuotaPermissionContext::AtomQuotaPermissionContext() = default;
@ -13,8 +15,8 @@ AtomQuotaPermissionContext::~AtomQuotaPermissionContext() = default;
void AtomQuotaPermissionContext::RequestQuotaPermission(
const content::StorageQuotaParams& params,
int render_process_id,
const PermissionCallback& callback) {
callback.Run(response::QUOTA_PERMISSION_RESPONSE_ALLOW);
PermissionCallback callback) {
std::move(callback).Run(response::QUOTA_PERMISSION_RESPONSE_ALLOW);
}
} // namespace electron

View file

@ -19,7 +19,7 @@ class AtomQuotaPermissionContext : public content::QuotaPermissionContext {
// content::QuotaPermissionContext:
void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id,
const PermissionCallback& callback) override;
PermissionCallback callback) override;
private:
~AtomQuotaPermissionContext() override;

View file

@ -20,7 +20,6 @@
#include "extensions/browser/component_extension_resource_manager.h"
#include "extensions/browser/core_extensions_browser_api_provider.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/mojo/interface_registration.h"
#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/updater/null_extension_cache.h"
#include "extensions/browser/url_request_util.h"
@ -215,9 +214,7 @@ void AtomExtensionsBrowserClient::RegisterExtensionInterfaces(
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
registry,
content::RenderFrameHost* render_frame_host,
const extensions::Extension* extension) const {
RegisterInterfacesForExtension(registry, render_frame_host, extension);
}
const extensions::Extension* extension) const {}
std::unique_ptr<extensions::RuntimeAPIDelegate>
AtomExtensionsBrowserClient::CreateRuntimeAPIDelegate(

View file

@ -21,7 +21,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 "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/common/asar/archive.h"
#include "shell/common/asar/asar_util.h"
@ -87,10 +87,10 @@ class AsarURLLoader : public network::mojom::URLLoader {
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
network::ResourceResponseHead head;
head.request_start = base::TimeTicks::Now();
head.response_start = base::TimeTicks::Now();
head.headers = extra_response_headers;
auto head = network::mojom::URLResponseHead::New();
head->request_start = base::TimeTicks::Now();
head->response_start = base::TimeTicks::Now();
head->headers = extra_response_headers;
base::FilePath path;
if (!net::FileURLToFilePath(request.url, &path)) {
@ -188,7 +188,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
total_bytes_written_ = total_bytes_to_send;
head.content_length = base::saturated_cast<int64_t>(total_bytes_to_send);
head->content_length = base::saturated_cast<int64_t>(total_bytes_to_send);
if (first_byte_to_send < read_result.bytes_read) {
// Write any data we read for MIME sniffing, constraining by range where
@ -211,20 +211,20 @@ class AsarURLLoader : public network::mojom::URLLoader {
total_bytes_to_send -= write_size;
}
if (!net::GetMimeTypeFromFile(path, &head.mime_type)) {
if (!net::GetMimeTypeFromFile(path, &head->mime_type)) {
std::string new_type;
net::SniffMimeType(initial_read_buffer.data(), read_result.bytes_read,
request.url, head.mime_type,
request.url, head->mime_type,
net::ForceSniffFileUrlsForHtml::kDisabled, &new_type);
head.mime_type.assign(new_type);
head.did_mime_sniff = true;
head->mime_type.assign(new_type);
head->did_mime_sniff = true;
}
if (head.headers) {
head.headers->AddHeader(
if (head->headers) {
head->headers->AddHeader(
base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType,
head.mime_type.c_str()));
head->mime_type.c_str()));
}
client_->OnReceiveResponse(head);
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(pipe.consumer_handle));
if (total_bytes_to_send == 0) {

View file

@ -88,24 +88,24 @@ gin::Dictionary ToDict(v8::Isolate* isolate, v8::Local<v8::Value> value) {
}
// Parse headers from response object.
network::ResourceResponseHead ToResponseHead(
network::mojom::URLResponseHeadPtr ToResponseHead(
const gin_helper::Dictionary& dict) {
network::ResourceResponseHead head;
head.mime_type = "text/html";
head.charset = "utf-8";
auto head = network::mojom::URLResponseHead::New();
head->mime_type = "text/html";
head->charset = "utf-8";
if (dict.IsEmpty()) {
head.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
head->headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
return head;
}
int status_code = 200;
dict.Get("statusCode", &status_code);
head.headers = new net::HttpResponseHeaders(base::StringPrintf(
head->headers = new net::HttpResponseHeaders(base::StringPrintf(
"HTTP/1.1 %d %s", status_code,
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code))));
dict.Get("charset", &head.charset);
bool has_mime_type = dict.Get("mimeType", &head.mime_type);
dict.Get("charset", &head->charset);
bool has_mime_type = dict.Get("mimeType", &head->mime_type);
bool has_content_type = false;
base::DictionaryValue headers;
@ -113,12 +113,12 @@ network::ResourceResponseHead ToResponseHead(
for (const auto& iter : headers.DictItems()) {
if (iter.second.is_string()) {
// key: value
head.headers->AddHeader(iter.first + ": " + iter.second.GetString());
head->headers->AddHeader(iter.first + ": " + iter.second.GetString());
} else if (iter.second.is_list()) {
// key: [values...]
for (const auto& item : iter.second.GetList()) {
if (item.is_string())
head.headers->AddHeader(iter.first + ": " + item.GetString());
head->headers->AddHeader(iter.first + ": " + item.GetString());
}
} else {
continue;
@ -126,16 +126,16 @@ network::ResourceResponseHead ToResponseHead(
// Some apps are passing content-type via headers, which is not accepted
// in NetworkService.
if (base::ToLowerASCII(iter.first) == "content-type") {
head.headers->GetMimeTypeAndCharset(&head.mime_type, &head.charset);
head->headers->GetMimeTypeAndCharset(&head->mime_type, &head->charset);
has_content_type = true;
}
}
}
// Setting |head.mime_type| does not automatically set the "content-type"
// Setting |head->mime_type| does not automatically set the "content-type"
// header in NetworkService.
if (has_mime_type && !has_content_type)
head.headers->AddHeader("content-type: " + head.mime_type);
head->headers->AddHeader("content-type: " + head->mime_type);
return head;
}
@ -225,7 +225,7 @@ void AtomURLLoaderFactory::StartLoading(
}
}
network::ResourceResponseHead head = ToResponseHead(dict);
network::mojom::URLResponseHeadPtr head = ToResponseHead(dict);
// Handle redirection.
//
@ -234,7 +234,7 @@ void AtomURLLoaderFactory::StartLoading(
// to implement redirection. This is also what Chromium does with WebRequest
// API in WebRequestProxyingURLLoaderFactory.
std::string location;
if (head.headers->IsRedirect(&location)) {
if (head->headers->IsRedirect(&location)) {
network::ResourceRequest new_request = request;
new_request.url = GURL(location);
// When the redirection comes from an intercepted scheme (which has
@ -310,7 +310,7 @@ void AtomURLLoaderFactory::StartLoading(
// static
void AtomURLLoaderFactory::StartLoadingBuffer(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict) {
v8::Local<v8::Value> buffer = dict.GetHandle();
dict.Get("data", &buffer);
@ -330,7 +330,7 @@ void AtomURLLoaderFactory::StartLoadingBuffer(
// static
void AtomURLLoaderFactory::StartLoadingString(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response) {
@ -355,7 +355,7 @@ void AtomURLLoaderFactory::StartLoadingFile(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
network::ResourceRequest request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response) {
@ -375,9 +375,9 @@ void AtomURLLoaderFactory::StartLoadingFile(
return;
}
head.headers->AddHeader(kCORSHeader);
head->headers->AddHeader(kCORSHeader);
asar::CreateAsarURLLoader(request, std::move(loader), std::move(client),
head.headers);
head->headers);
}
// static
@ -426,7 +426,7 @@ void AtomURLLoaderFactory::StartLoadingHttp(
void AtomURLLoaderFactory::StartLoadingStream(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict) {
v8::Local<v8::Value> stream;
if (!dict.Get("data", &stream)) {
@ -440,7 +440,7 @@ void AtomURLLoaderFactory::StartLoadingStream(
//
// Note that We must submit a empty body otherwise NetworkService would
// crash.
client_remote->OnReceiveResponse(head);
client_remote->OnReceiveResponse(std::move(head));
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) {
@ -478,12 +478,12 @@ void AtomURLLoaderFactory::StartLoadingStream(
// static
void AtomURLLoaderFactory::SendContents(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
std::string data) {
mojo::Remote<network::mojom::URLLoaderClient> client_remote(
std::move(client));
head.headers->AddHeader(kCORSHeader);
client_remote->OnReceiveResponse(head);
head->headers->AddHeader(kCORSHeader);
client_remote->OnReceiveResponse(std::move(head));
// Code bellow follows the pattern of data_url_loader_factory.cc.
mojo::ScopedDataPipeProducerHandle producer;

View file

@ -14,8 +14,8 @@
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/url_request/url_request_job_factory.h"
#include "services/network/public/cpp/resource_response.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/common/gin_helper/dictionary.h"
namespace electron {
@ -72,11 +72,11 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
private:
static void StartLoadingBuffer(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict);
static void StartLoadingString(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
@ -84,7 +84,7 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
mojo::PendingReceiver<network::mojom::URLLoader> loader,
network::ResourceRequest request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict,
v8::Isolate* isolate,
v8::Local<v8::Value> response);
@ -97,13 +97,13 @@ class AtomURLLoaderFactory : public network::mojom::URLLoaderFactory {
static void StartLoadingStream(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
const gin_helper::Dictionary& dict);
// Helper to send string as response.
static void SendContents(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
std::string data);
// TODO(zcbenz): This comes from extensions/browser/extension_protocols.cc

View file

@ -13,7 +13,7 @@
namespace electron {
NodeStreamLoader::NodeStreamLoader(
network::ResourceResponseHead head,
network::mojom::URLResponseHeadPtr head,
network::mojom::URLLoaderRequest loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
v8::Isolate* isolate,
@ -44,7 +44,7 @@ NodeStreamLoader::~NodeStreamLoader() {
}
}
void NodeStreamLoader::Start(network::ResourceResponseHead head) {
void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer);
@ -54,7 +54,7 @@ void NodeStreamLoader::Start(network::ResourceResponseHead head) {
}
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
client_->OnReceiveResponse(head);
client_->OnReceiveResponse(std::move(head));
client_->OnStartLoadingResponseBody(std::move(consumer));
auto weak = weak_factory_.GetWeakPtr();

View file

@ -14,8 +14,8 @@
#include "mojo/public/cpp/bindings/remote.h"
#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 "services/network/public/mojom/url_response_head.mojom.h"
#include "v8/include/v8.h"
namespace electron {
@ -30,7 +30,7 @@ namespace electron {
// the passed |Buffer| is alive while writing data to pipe.
class NodeStreamLoader : public network::mojom::URLLoader {
public:
NodeStreamLoader(network::ResourceResponseHead head,
NodeStreamLoader(network::mojom::URLResponseHeadPtr head,
network::mojom::URLLoaderRequest loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
v8::Isolate* isolate,
@ -41,7 +41,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
using EventCallback = base::RepeatingCallback<void()>;
void Start(network::ResourceResponseHead head);
void Start(network::mojom::URLResponseHeadPtr head);
void NotifyReadable();
void NotifyComplete(int result);
void ReadMore();

View file

@ -7,6 +7,7 @@
#include <utility>
#include "base/command_line.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/extension_navigation_ui_data.h"