chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111)

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
Electron Bot 2021-01-12 15:31:23 -08:00 committed by GitHub
parent 1cd72425aa
commit adf0a73543
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 503 additions and 460 deletions

View file

@ -64,7 +64,7 @@ bool NativeTheme::ShouldUseDarkColors() {
}
bool NativeTheme::ShouldUseHighContrastColors() {
return ui_theme_->UsesHighContrastColors();
return ui_theme_->UserHasContrastPreference();
}
#if defined(OS_MAC)

View file

@ -38,7 +38,7 @@ bool SystemPreferences::IsInvertedColorScheme() {
}
bool SystemPreferences::IsHighContrastColorScheme() {
return ui::NativeTheme::GetInstanceForNativeUi()->UsesHighContrastColors();
return ui::NativeTheme::GetInstanceForNativeUi()->UserHasContrastPreference();
}
v8::Local<v8::Value> SystemPreferences::GetAnimationSettings(

View file

@ -127,10 +127,6 @@
#include "shell/browser/fake_location_provider.h"
#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/printing_message_filter.h"
#endif // BUILDFLAG(ENABLE_PRINTING)
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "chrome/common/webui_url_constants.h"
#include "content/public/browser/child_process_security_policy.h"
@ -534,11 +530,6 @@ void ElectronBrowserClient::RenderProcessWillLaunch(
auto* browser_context = host->GetBrowserContext();
ALLOW_UNUSED_LOCAL(browser_context);
#if BUILDFLAG(ENABLE_PRINTING)
host->AddFilter(
new printing::PrintingMessageFilter(process_id, browser_context));
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
host->AddFilter(
new extensions::ExtensionMessageFilter(process_id, browser_context));

View file

@ -38,7 +38,7 @@ class ManagementSetEnabledFunctionInstallPromptDelegate
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) {
base::OnceCallback<void(bool)> callback) {
// TODO(sentialx): emit event
}
~ManagementSetEnabledFunctionInstallPromptDelegate() override {}
@ -109,10 +109,10 @@ ElectronManagementAPIDelegate::SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const {
base::OnceCallback<void(bool)> callback) const {
return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>(
new ManagementSetEnabledFunctionInstallPromptDelegate(
web_contents, browser_context, extension, callback));
web_contents, browser_context, extension, std::move(callback)));
}
std::unique_ptr<extensions::UninstallDialogDelegate>

View file

@ -31,7 +31,7 @@ class ElectronManagementAPIDelegate : public extensions::ManagementAPIDelegate {
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const override;
base::OnceCallback<void(bool)> callback) const override;
std::unique_ptr<extensions::UninstallDialogDelegate>
UninstallFunctionDelegate(
extensions::ManagementUninstallFunctionBase* function,

View file

@ -36,7 +36,7 @@ void ElectronRuntimeAPIDelegate::ReloadExtension(
bool ElectronRuntimeAPIDelegate::CheckForUpdates(
const std::string& extension_id,
const UpdateCheckCallback& callback) {
UpdateCheckCallback callback) {
return false;
}

View file

@ -26,7 +26,7 @@ class ElectronRuntimeAPIDelegate : public RuntimeAPIDelegate {
void RemoveUpdateObserver(UpdateObserver* observer) override;
void ReloadExtension(const std::string& extension_id) override;
bool CheckForUpdates(const std::string& extension_id,
const UpdateCheckCallback& callback) override;
UpdateCheckCallback callback) override;
void OpenURL(const GURL& uninstall_url) override;
bool GetPlatformInfo(api::runtime::PlatformInfo* info) override;
bool RestartDevice(std::string* error_message) override;

View file

@ -5,6 +5,7 @@
#include "shell/browser/extensions/electron_messaging_delegate.h"
#include <memory>
#include <utility>
#include "base/callback.h"
#include "base/logging.h"
@ -107,9 +108,9 @@ void ElectronMessagingDelegate::QueryIncognitoConnectability(
const Extension* target_extension,
content::WebContents* source_contents,
const GURL& source_url,
const base::Callback<void(bool)>& callback) {
base::OnceCallback<void(bool)> callback) {
DCHECK(context->IsOffTheRecord());
callback.Run(false);
std::move(callback).Run(false);
}
} // namespace extensions

View file

@ -47,7 +47,7 @@ class ElectronMessagingDelegate : public MessagingDelegate {
const Extension* extension,
content::WebContents* web_contents,
const GURL& url,
const base::Callback<void(bool)>& callback) override;
base::OnceCallback<void(bool)> callback) override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronMessagingDelegate);

View file

@ -263,8 +263,9 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
}
if (!state_atom_list.empty())
ui::SetAtomArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
"_NET_WM_STATE", "ATOM", state_atom_list);
SetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), x11::Atom::ATOM,
state_atom_list);
// Set the _NET_WM_WINDOW_TYPE.
if (!window_type.empty())
@ -1240,8 +1241,8 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
// determine whether the current window is visible on all workspaces.
x11::Atom sticky_atom = x11::GetAtom("_NET_WM_STATE_STICKY");
std::vector<x11::Atom> wm_states;
ui::GetAtomArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
"_NET_WM_STATE", &wm_states);
GetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), &wm_states);
return std::find(wm_states.begin(), wm_states.end(), sticky_atom) !=
wm_states.end();
}

View file

@ -171,7 +171,7 @@ void OffScreenWebContentsView::StartDragging(
}
void OffScreenWebContentsView::UpdateDragCursor(
blink::DragOperation operation) {}
ui::mojom::DragOperation operation) {}
void OffScreenWebContentsView::SetPainting(bool painting) {
auto* view = GetView();

View file

@ -74,7 +74,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
const gfx::Vector2d& image_offset,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::DragOperation operation) override;
void UpdateDragCursor(ui::mojom::DragOperation operation) override;
void SetPainting(bool painting);
bool IsPainting() const;
void SetFrameRate(int frame_rate);

View file

@ -217,6 +217,12 @@ void PrintPreviewMessageHandler::PrintPreviewCancelled(int32_t document_cookie,
RejectPromise(request_id);
}
void PrintPreviewMessageHandler::CheckForCancel(
int32_t request_id,
CheckForCancelCallback callback) {
std::move(callback).Run(false);
}
void PrintPreviewMessageHandler::PrintToPDF(
base::DictionaryValue options,
gin_helper::Promise<v8::Local<v8::Value>> promise) {

View file

@ -80,6 +80,8 @@ class PrintPreviewMessageHandler
int32_t request_id) override;
void PrinterSettingsInvalid(int32_t document_cookie,
int32_t request_id) override {}
void CheckForCancel(int32_t request_id,
CheckForCancelCallback callback) override;
gin_helper::Promise<v8::Local<v8::Value>> GetPromise(int request_id);

View file

@ -194,12 +194,12 @@ class InspectableWebContents::NetworkResourceLoader
const network::ResourceRequest& resource_request,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
URLLoaderFactoryHolder url_loader_factory,
const DispatchCallback& callback,
DispatchCallback callback,
base::TimeDelta retry_delay = base::TimeDelta()) {
auto resource_loader =
std::make_unique<InspectableWebContents::NetworkResourceLoader>(
stream_id, bindings, resource_request, traffic_annotation,
std::move(url_loader_factory), callback, retry_delay);
std::move(url_loader_factory), std::move(callback), retry_delay);
bindings->loaders_.insert(std::move(resource_loader));
}
@ -209,7 +209,7 @@ class InspectableWebContents::NetworkResourceLoader
const network::ResourceRequest& resource_request,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
URLLoaderFactoryHolder url_loader_factory,
const DispatchCallback& callback,
DispatchCallback callback,
base::TimeDelta delay)
: stream_id_(stream_id),
bindings_(bindings),
@ -219,7 +219,7 @@ class InspectableWebContents::NetworkResourceLoader
std::make_unique<network::ResourceRequest>(resource_request),
traffic_annotation)),
url_loader_factory_(std::move(url_loader_factory)),
callback_(callback),
callback_(std::move(callback)),
retry_delay_(delay) {
loader_->SetOnResponseStartedCallback(base::BindOnce(
&NetworkResourceLoader::OnResponseStarted, base::Unretained(this)));
@ -280,7 +280,7 @@ class InspectableWebContents::NetworkResourceLoader
<< delay << "." << std::endl;
NetworkResourceLoader::Create(
stream_id_, bindings_, resource_request_, traffic_annotation_,
std::move(url_loader_factory_), callback_, delay);
std::move(url_loader_factory_), std::move(callback_), delay);
} else {
base::DictionaryValue response;
response.SetInteger("statusCode", response_headers_
@ -296,7 +296,7 @@ class InspectableWebContents::NetworkResourceLoader
headers->SetString(name, value);
response.Set("headers", std::move(headers));
callback_.Run(&response);
std::move(callback_).Run(&response);
}
bindings_->loaders_.erase(bindings_->loaders_.find(this));
@ -497,12 +497,12 @@ void InspectableWebContents::Detach() {
agent_host_ = nullptr;
}
void InspectableWebContents::Reattach(const DispatchCallback& callback) {
void InspectableWebContents::Reattach(DispatchCallback callback) {
if (agent_host_) {
agent_host_->DetachClient(this);
agent_host_->AttachClient(this);
}
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::CallClientFunction(
@ -643,16 +643,15 @@ void InspectableWebContents::InspectedURLChanged(const std::string& url) {
base::UTF8ToUTF16(base::StringPrintf(kTitleFormat, url.c_str())));
}
void InspectableWebContents::LoadNetworkResource(
const DispatchCallback& callback,
const std::string& url,
const std::string& headers,
int stream_id) {
void InspectableWebContents::LoadNetworkResource(DispatchCallback callback,
const std::string& url,
const std::string& headers,
int stream_id) {
GURL gurl(url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
callback.Run(&response);
std::move(callback).Run(&response);
return;
}
@ -696,17 +695,17 @@ void InspectableWebContents::LoadNetworkResource(
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
}
NetworkResourceLoader::Create(stream_id, this, resource_request,
traffic_annotation,
std::move(url_loader_factory), callback);
NetworkResourceLoader::Create(
stream_id, this, resource_request, traffic_annotation,
std::move(url_loader_factory), std::move(callback));
}
void InspectableWebContents::SetIsDocked(const DispatchCallback& callback,
void InspectableWebContents::SetIsDocked(DispatchCallback callback,
bool docked) {
if (managed_devtools_web_contents_)
view_->SetIsDocked(docked, activate_);
if (!callback.is_null())
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::OpenInNewTab(const std::string& url) {}
@ -835,16 +834,16 @@ void InspectableWebContents::DispatchProtocolMessageFromDevToolsFrontend(
this, base::as_bytes(base::make_span(message)));
}
void InspectableWebContents::SendJsonRequest(const DispatchCallback& callback,
void InspectableWebContents::SendJsonRequest(DispatchCallback callback,
const std::string& browser_id,
const std::string& url) {
callback.Run(nullptr);
std::move(callback).Run(nullptr);
}
void InspectableWebContents::GetPreferences(const DispatchCallback& callback) {
void InspectableWebContents::GetPreferences(DispatchCallback callback) {
const base::DictionaryValue* prefs =
pref_service_->GetDictionary(kDevToolsPreferences);
callback.Run(prefs);
std::move(callback).Run(prefs);
}
void InspectableWebContents::SetPreference(const std::string& name,

View file

@ -86,11 +86,11 @@ class InspectableWebContents
void SetInspectedPageBounds(const gfx::Rect& rect) override;
void InspectElementCompleted() override;
void InspectedURLChanged(const std::string& url) override;
void LoadNetworkResource(const DispatchCallback& callback,
void LoadNetworkResource(DispatchCallback callback,
const std::string& url,
const std::string& headers,
int stream_id) override;
void SetIsDocked(const DispatchCallback& callback, bool is_docked) override;
void SetIsDocked(DispatchCallback callback, bool is_docked) override;
void OpenInNewTab(const std::string& url) override;
void ShowItemInFolder(const std::string& file_system_path) override;
void SaveToFile(const std::string& url,
@ -130,10 +130,10 @@ class InspectableWebContents
void OpenNodeFrontend() override;
void DispatchProtocolMessageFromDevToolsFrontend(
const std::string& message) override;
void SendJsonRequest(const DispatchCallback& callback,
void SendJsonRequest(DispatchCallback callback,
const std::string& browser_id,
const std::string& url) override;
void GetPreferences(const DispatchCallback& callback) override;
void GetPreferences(DispatchCallback callback) override;
void SetPreference(const std::string& name,
const std::string& value) override;
void RemovePreference(const std::string& name) override;
@ -141,7 +141,7 @@ class InspectableWebContents
void ConnectionReady() override;
void RegisterExtensionsAPI(const std::string& origin,
const std::string& script) override;
void Reattach(const DispatchCallback& callback) override;
void Reattach(DispatchCallback callback) override;
void RecordEnumeratedHistogram(const std::string& name,
int sample,
int boundary_value) override {}
@ -150,9 +150,9 @@ class InspectableWebContents
void RecordPerformanceHistogram(const std::string& name,
double duration) override {}
void RecordUserMetricsAction(const std::string& name) override {}
void ShowSurvey(const DispatchCallback& callback,
void ShowSurvey(DispatchCallback callback,
const std::string& trigger) override {}
void CanShowSurvey(const DispatchCallback& callback,
void CanShowSurvey(DispatchCallback callback,
const std::string& trigger) override {}
// content::DevToolsFrontendHostDelegate:

View file

@ -8,6 +8,7 @@
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/xproto_util.h"
namespace electron {
@ -29,9 +30,9 @@ void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
std::vector<x11::Atom> wm_states;
if (ui::GetAtomArrayProperty(
if (GetArrayProperty(
static_cast<x11::Window>(window_->GetAcceleratedWidget()),
"_NET_WM_STATE", &wm_states)) {
x11::GetAtom("_NET_WM_STATE"), &wm_states)) {
auto props =
base::flat_set<x11::Atom>(std::begin(wm_states), std::end(wm_states));
bool is_minimized =

View file

@ -109,8 +109,11 @@ base::win::ScopedHICON ReadICOFromPath(int size, const base::FilePath& path) {
NativeImage::NativeImage(v8::Isolate* isolate, const gfx::Image& image)
: image_(image), isolate_(isolate) {
if (image_.HasRepresentation(gfx::Image::kImageRepSkia)) {
isolate_->AdjustAmountOfExternalAllocatedMemory(
image_.ToImageSkia()->bitmap()->computeByteSize());
auto* const image_skia = image_.ToImageSkia();
if (!image_skia->isNull()) {
isolate_->AdjustAmountOfExternalAllocatedMemory(
image_skia->bitmap()->computeByteSize());
}
}
}
@ -122,16 +125,21 @@ NativeImage::NativeImage(v8::Isolate* isolate, const base::FilePath& hicon_path)
electron::util::ReadImageSkiaFromICO(&image_skia, GetHICON(256));
image_ = gfx::Image(image_skia);
if (image_.HasRepresentation(gfx::Image::kImageRepSkia)) {
isolate_->AdjustAmountOfExternalAllocatedMemory(
image_.ToImageSkia()->bitmap()->computeByteSize());
if (!image_skia.isNull()) {
isolate_->AdjustAmountOfExternalAllocatedMemory(
image_.ToImageSkia()->bitmap()->computeByteSize());
}
}
}
#endif
NativeImage::~NativeImage() {
if (image_.HasRepresentation(gfx::Image::kImageRepSkia)) {
isolate_->AdjustAmountOfExternalAllocatedMemory(-static_cast<int64_t>(
image_.ToImageSkia()->bitmap()->computeByteSize()));
auto* const image_skia = image_.ToImageSkia();
if (!image_skia->isNull()) {
isolate_->AdjustAmountOfExternalAllocatedMemory(
image_skia->bitmap()->computeByteSize());
}
}
}
@ -325,7 +333,9 @@ gin::Handle<NativeImage> NativeImage::Resize(gin::Arguments* args,
bool height_set = options.GetInteger("height", &height);
size.SetSize(width, height);
if (width_set && !height_set) {
if (width <= 0 && height <= 0) {
return CreateEmpty(args->isolate());
} else if (width_set && !height_set) {
// Scale height to preserve original aspect ratio
size.set_height(width);
size =
@ -500,8 +510,8 @@ gin::Handle<NativeImage> NativeImage::CreateFromBitmap(
bitmap.allocN32Pixels(width, height, false);
bitmap.writePixels({info, node::Buffer::Data(buffer), bitmap.rowBytes()});
gfx::ImageSkia image_skia;
image_skia.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
gfx::ImageSkia image_skia =
gfx::ImageSkia::CreateFromBitmap(bitmap, scale_factor);
return Create(thrower.isolate(), gfx::Image(image_skia));
}

View file

@ -93,9 +93,8 @@ v8::Local<v8::Promise> NativeImage::CreateThumbnailFromPath(
base::win::ScopedHICON icon(CreateIconIndirect(&icon_info));
SkBitmap skbitmap = IconUtil::CreateSkBitmapFromHICON(icon.get());
gfx::ImageSkia image_skia;
image_skia.AddRepresentation(
gfx::ImageSkiaRep(skbitmap, 1.0 /*scale factor*/));
gfx::ImageSkia image_skia =
gfx::ImageSkia::CreateFromBitmap(skbitmap, 1.0 /*scale factor*/);
gfx::Image gfx_image = gfx::Image(image_skia);
promise.Resolve(gfx_image);
return handle;

View file

@ -325,21 +325,21 @@ bool Converter<blink::DeviceEmulationParams>::FromV8(
}
// static
v8::Local<v8::Value> Converter<blink::ContextMenuDataMediaType>::ToV8(
v8::Local<v8::Value> Converter<blink::mojom::ContextMenuDataMediaType>::ToV8(
v8::Isolate* isolate,
const blink::ContextMenuDataMediaType& in) {
const blink::mojom::ContextMenuDataMediaType& in) {
switch (in) {
case blink::ContextMenuDataMediaType::kImage:
case blink::mojom::ContextMenuDataMediaType::kImage:
return StringToV8(isolate, "image");
case blink::ContextMenuDataMediaType::kVideo:
case blink::mojom::ContextMenuDataMediaType::kVideo:
return StringToV8(isolate, "video");
case blink::ContextMenuDataMediaType::kAudio:
case blink::mojom::ContextMenuDataMediaType::kAudio:
return StringToV8(isolate, "audio");
case blink::ContextMenuDataMediaType::kCanvas:
case blink::mojom::ContextMenuDataMediaType::kCanvas:
return StringToV8(isolate, "canvas");
case blink::ContextMenuDataMediaType::kFile:
case blink::mojom::ContextMenuDataMediaType::kFile:
return StringToV8(isolate, "file");
case blink::ContextMenuDataMediaType::kPlugin:
case blink::mojom::ContextMenuDataMediaType::kPlugin:
return StringToV8(isolate, "plugin");
default:
return StringToV8(isolate, "none");

View file

@ -67,9 +67,10 @@ struct Converter<blink::DeviceEmulationParams> {
};
template <>
struct Converter<blink::ContextMenuDataMediaType> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::ContextMenuDataMediaType& in);
struct Converter<blink::mojom::ContextMenuDataMediaType> {
static v8::Local<v8::Value> ToV8(
v8::Isolate* isolate,
const blink::mojom::ContextMenuDataMediaType& in);
};
template <>

View file

@ -144,7 +144,7 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithWebContents>::ToV8(
dict.Set("mediaType", params.media_type);
dict.Set("mediaFlags", MediaFlagsToV8(isolate, params.media_flags));
bool has_image_contents =
(params.media_type == blink::ContextMenuDataMediaType::kImage) &&
(params.media_type == blink::mojom::ContextMenuDataMediaType::kImage) &&
params.has_image_contents;
dict.Set("hasImageContents", has_image_contents);
dict.Set("isEditable", params.is_editable);