chore: bump chromium to 98ebf6c3f0b7bd96bdb1a4b42208f (master) (#22999)

Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
This commit is contained in:
Electron Bot 2020-04-13 16:39:26 -07:00 committed by GitHub
parent b8c1709a88
commit 3e8d77d564
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 645 additions and 673 deletions

View file

@ -544,7 +544,6 @@ App::App(v8::Isolate* isolate) {
static_cast<ElectronBrowserClient*>(ElectronBrowserClient::Get())
->set_delegate(this);
Browser::Get()->AddObserver(this);
content::GpuDataManager::GetInstance()->AddObserver(this);
base::ProcessId pid = base::GetCurrentProcId();
auto process_metric = std::make_unique<electron::ProcessMetric>(
@ -622,6 +621,21 @@ void App::OnPreMainMessageLoopRun() {
}
}
void App::OnPreCreateThreads() {
DCHECK(!content::GpuDataManager::Initialized());
content::GpuDataManager* manager = content::GpuDataManager::GetInstance();
manager->AddObserver(this);
if (disable_hw_acceleration_) {
manager->DisableHardwareAcceleration();
}
if (disable_domain_blocking_for_3DAPIs_) {
content::GpuDataManagerImpl::GetInstance()
->DisableDomainBlockingFor3DAPIsForTesting();
}
}
void App::OnAccessibilitySupportChanged() {
Emit("accessibility-support-changed", IsAccessibilitySupportEnabled());
}
@ -1031,7 +1045,11 @@ void App::DisableHardwareAcceleration(gin_helper::ErrorThrower thrower) {
"before app is ready");
return;
}
content::GpuDataManager::GetInstance()->DisableHardwareAcceleration();
if (content::GpuDataManager::Initialized()) {
content::GpuDataManager::GetInstance()->DisableHardwareAcceleration();
} else {
disable_hw_acceleration_ = true;
}
}
void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) {
@ -1041,8 +1059,12 @@ void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) {
"before app is ready");
return;
}
content::GpuDataManagerImpl::GetInstance()
->DisableDomainBlockingFor3DAPIsForTesting();
if (content::GpuDataManager::Initialized()) {
content::GpuDataManagerImpl::GetInstance()
->DisableDomainBlockingFor3DAPIsForTesting();
} else {
disable_domain_blocking_for_3DAPIs_ = true;
}
}
bool App::IsAccessibilitySupportEnabled() {

View file

@ -70,7 +70,6 @@ class App : public ElectronBrowserClient::Delegate,
base::FilePath GetAppPath() const;
void RenderProcessReady(content::RenderProcessHost* host);
void RenderProcessDisconnected(base::ProcessId host_pid);
void PreMainMessageLoopRun();
protected:
explicit App(v8::Isolate* isolate);
@ -88,6 +87,7 @@ class App : public ElectronBrowserClient::Delegate,
void OnFinishLaunching(const base::DictionaryValue& launch_info) override;
void OnAccessibilitySupportChanged() override;
void OnPreMainMessageLoopRun() override;
void OnPreCreateThreads() override;
#if defined(OS_MACOSX)
void OnWillContinueUserActivity(bool* prevent_default,
const std::string& type) override;
@ -240,6 +240,9 @@ class App : public ElectronBrowserClient::Delegate,
std::unique_ptr<electron::ProcessMetric>>;
ProcessMetricMap app_metrics_;
bool disable_hw_acceleration_ = false;
bool disable_domain_blocking_for_3DAPIs_ = false;
DISALLOW_COPY_AND_ASSIGN(App);
};

View file

@ -248,7 +248,7 @@ v8::Local<v8::Promise> Cookies::Get(v8::Isolate* isolate,
net::CookieOptions options;
options.set_include_httponly();
options.set_same_site_cookie_context(
net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
options.set_do_not_update_access_time();
manager->GetCookieList(GURL(url), options,
@ -332,7 +332,7 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
options.set_include_httponly();
}
options.set_same_site_cookie_context(
net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
auto* storage_partition =
content::BrowserContext::GetDefaultStoragePartition(browser_context_);

View file

@ -15,6 +15,7 @@
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
#include "ui/base/models/image_model.h"
namespace electron {
@ -142,7 +143,7 @@ void Menu::InsertSubMenuAt(int index,
}
void Menu::SetIcon(int index, const gfx::Image& image) {
model_->SetIcon(index, image);
model_->SetIcon(index, ui::ImageModel::FromImage(image));
}
void Menu::SetSublabel(int index, const base::string16& sublabel) {

View file

@ -89,7 +89,8 @@ bool NativeTheme::ShouldUseInvertedColorScheme() {
return false;
return is_inverted;
#else
return color_utils::IsInvertedColorScheme();
return ui_theme_->GetHighContrastColorScheme() ==
ui::NativeTheme::HighContrastColorScheme::kDark;
#endif
}

View file

@ -37,7 +37,9 @@ bool SystemPreferences::IsDarkMode() {
#endif
bool SystemPreferences::IsInvertedColorScheme() {
return color_utils::IsInvertedColorScheme();
return ui::NativeTheme::GetInstanceForNativeUi()
->GetHighContrastColorScheme() ==
ui::NativeTheme::HighContrastColorScheme::kDark;
}
bool SystemPreferences::IsHighContrastColorScheme() {

View file

@ -392,7 +392,8 @@ WebContents::WebContents(v8::Isolate* isolate,
: content::WebContentsObserver(web_contents),
type_(Type::REMOTE),
weak_factory_(this) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
web_contents->SetUserAgentOverride(blink::UserAgentOverride::UserAgentOnly(
GetBrowserContext()->GetUserAgent()),
false);
Init(isolate);
AttachAsUserData(web_contents);
@ -570,7 +571,8 @@ void WebContents::InitWithSessionAndOptions(
&WebContents::OnElectronBrowserConnectionError, base::Unretained(this)));
AutofillDriverFactory::CreateForWebContents(web_contents());
web_contents()->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
web_contents()->SetUserAgentOverride(blink::UserAgentOverride::UserAgentOnly(
GetBrowserContext()->GetUserAgent()),
false);
if (IsGuest()) {
@ -1491,7 +1493,8 @@ void WebContents::LoadURL(const GURL& url,
std::string user_agent;
if (options.Get("userAgent", &user_agent))
web_contents()->SetUserAgentOverride(user_agent, false);
web_contents()->SetUserAgentOverride(
blink::UserAgentOverride::UserAgentOnly(user_agent), false);
std::string extra_headers;
if (options.Get("extraHeaders", &extra_headers))
@ -1623,11 +1626,12 @@ bool WebContents::IsCrashed() const {
void WebContents::SetUserAgent(const std::string& user_agent,
gin_helper::Arguments* args) {
web_contents()->SetUserAgentOverride(user_agent, false);
web_contents()->SetUserAgentOverride(
blink::UserAgentOverride::UserAgentOnly(user_agent), false);
}
std::string WebContents::GetUserAgent() {
return web_contents()->GetUserAgentOverride();
return web_contents()->GetUserAgentOverride().ua_string_override;
}
v8::Local<v8::Promise> WebContents::SavePage(

View file

@ -145,6 +145,8 @@ void FrameSubscriber::OnFrameCaptured(
void FrameSubscriber::OnStopped() {}
void FrameSubscriber::OnLog(const std::string& message) {}
void FrameSubscriber::Done(const gfx::Rect& damage, const SkBitmap& frame) {
if (frame.drawsNothing())
return;

View file

@ -6,6 +6,7 @@
#define SHELL_BROWSER_API_FRAME_SUBSCRIBER_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
@ -53,6 +54,7 @@ class FrameSubscriber : public content::WebContentsObserver,
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
callbacks) override;
void OnStopped() override;
void OnLog(const std::string& message) override;
void Done(const gfx::Rect& damage, const SkBitmap& frame);

View file

@ -202,6 +202,12 @@ void Browser::PreMainMessageLoopRun() {
}
}
void Browser::PreCreateThreads() {
for (BrowserObserver& observer : observers_) {
observer.OnPreCreateThreads();
}
}
void Browser::SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure) {
if (is_shutdown_)
RunQuitClosure(std::move(quit_closure));

View file

@ -251,6 +251,7 @@ class Browser : public WindowListObserver {
void OnAccessibilitySupportChanged();
void PreMainMessageLoopRun();
void PreCreateThreads();
// Stores the supplied |quit_closure|, to be run when the last Browser
// instance is destroyed.

View file

@ -16,8 +16,8 @@
#include "shell/common/application_info.h"
#if defined(USE_X11)
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "shell/browser/linux/unity_service.h"
#include "ui/gtk/gtk_util.h"
#endif
namespace electron {

View file

@ -55,6 +55,11 @@ class BrowserObserver : public base::CheckedObserver {
// The app message loop is ready
virtual void OnPreMainMessageLoopRun() {}
// Called just before app threads are created, this is where first access
// to in-process GpuDataManager should be made.
// Refer https://chromium-review.googlesource.com/c/chromium/src/+/2134864
virtual void OnPreCreateThreads() {}
#if defined(OS_MACOSX)
// The browser wants to report that an user activity will resume. (macOS only)
virtual void OnWillContinueUserActivity(bool* prevent_default,

View file

@ -64,11 +64,14 @@
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ui/gtk/gtk_ui.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/base/x/x11_util.h"
#include "ui/base/x/x11_util_internal.h"
#include "ui/events/devices/x11/touch_factory_x11.h"
#include "ui/gfx/x/x11_types.h"
#include "ui/gtk/gtk_ui.h"
#include "ui/gtk/gtk_ui_delegate.h"
#include "ui/gtk/gtk_ui_delegate_x11.h"
#include "ui/gtk/gtk_util.h"
#include "ui/views/linux_ui/linux_ui.h"
#endif
@ -258,7 +261,6 @@ void ElectronBrowserMainParts::RegisterDestructionCallback(
int ElectronBrowserMainParts::PreEarlyInitialization() {
field_trial_list_ = std::make_unique<base::FieldTrialList>(nullptr);
#if defined(USE_X11)
views::LinuxUI::SetInstance(BuildGtkUi());
OverrideLinuxAppDataPath();
// Installs the X11 error handlers for the browser process used during
@ -343,6 +345,9 @@ int ElectronBrowserMainParts::PreCreateThreads() {
fake_browser_process_->PreCreateThreads();
// Notify observers.
Browser::Get()->PreCreateThreads();
return 0;
}
@ -365,6 +370,13 @@ void ElectronBrowserMainParts::PostDestroyThreads() {
}
void ElectronBrowserMainParts::ToolkitInitialized() {
#if defined(USE_X11)
// In Aura/X11, Gtk-based LinuxUI implementation is used.
gtk_ui_delegate_ = std::make_unique<ui::GtkUiDelegateX11>(gfx::GetXDisplay());
ui::GtkUiDelegate::SetInstance(gtk_ui_delegate_.get());
views::LinuxUI::SetInstance(BuildGtkUi(ui::GtkUiDelegate::instance()));
#endif
#if defined(USE_AURA) && defined(USE_X11)
views::LinuxUI::instance()->Initialize();
#endif

View file

@ -29,6 +29,12 @@ class WMState;
}
#endif
#if defined(USE_X11)
namespace ui {
class GtkUiDelegate;
}
#endif
namespace electron {
class ElectronBrowserContext;
@ -121,6 +127,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
std::unique_ptr<wm::WMState> wm_state_;
#endif
#if defined(USE_X11)
std::unique_ptr<ui::GtkUiDelegate> gtk_ui_delegate_;
#endif
std::unique_ptr<views::LayoutProvider> layout_provider_;
// A fake BrowserProcess object that used to feed the source code from chrome.

View file

@ -209,6 +209,12 @@ bool ElectronExtensionSystem::FinishDelayedInstallationIfReady(
return false;
}
void ElectronExtensionSystem::PerformActionBasedOnOmahaAttributes(
const std::string& extension_id,
const base::Value& attributes) {
NOTREACHED();
}
void ElectronExtensionSystem::OnExtensionRegisteredWithRequestContexts(
scoped_refptr<Extension> extension) {
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);

View file

@ -84,6 +84,9 @@ class ElectronExtensionSystem : public ExtensionSystem {
InstallUpdateCallback install_update_callback) override;
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
bool install_immediately) override;
void PerformActionBasedOnOmahaAttributes(
const std::string& extension_id,
const base::Value& attributes) override;
private:
void OnExtensionRegisteredWithRequestContexts(

View file

@ -94,8 +94,8 @@ ResolveProxyHelper::PendingRequest::PendingRequest(
ResolveProxyHelper::PendingRequest::~PendingRequest() noexcept = default;
ResolveProxyHelper::PendingRequest& ResolveProxyHelper::PendingRequest::
operator=(ResolveProxyHelper::PendingRequest&& pending_request) noexcept =
default;
ResolveProxyHelper::PendingRequest&
ResolveProxyHelper::PendingRequest::operator=(
ResolveProxyHelper::PendingRequest&& pending_request) noexcept = default;
} // namespace electron

View file

@ -12,12 +12,12 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "shell/browser/notifications/notification_delegate.h"
#include "shell/browser/ui/gtk_util.h"
#include "shell/common/application_info.h"
#include "shell/common/platform_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gtk/gtk_util.h"
namespace electron {

View file

@ -126,6 +126,8 @@ void OffScreenVideoConsumer::OnFrameCaptured(
void OffScreenVideoConsumer::OnStopped() {}
void OffScreenVideoConsumer::OnLog(const std::string& message) {}
bool OffScreenVideoConsumer::CheckContentRect(const gfx::Rect& content_rect) {
gfx::Size view_size = view_->SizeInPixels();
gfx::Size content_size = content_rect.size();

View file

@ -6,6 +6,7 @@
#define SHELL_BROWSER_OSR_OSR_VIDEO_CONSUMER_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
@ -38,6 +39,7 @@ class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer {
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
callbacks) override;
void OnStopped() override;
void OnLog(const std::string& message) override;
bool CheckContentRect(const gfx::Rect& content_rect);

View file

@ -9,7 +9,7 @@
#include <vector>
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/autofill/popup_view_common.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_view_utils.h"
#include "electron/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "shell/browser/native_window_views.h"
@ -31,19 +31,6 @@
namespace electron {
class PopupViewCommon : public autofill::PopupViewCommon {
public:
explicit PopupViewCommon(const gfx::Rect& window_bounds)
: window_bounds_(window_bounds) {}
gfx::Rect GetWindowBounds(gfx::NativeView container_view) override {
return window_bounds_;
}
private:
gfx::Rect window_bounds_;
};
AutofillPopup::AutofillPopup() {
bold_font_list_ = gfx::FontList().DeriveWithWeight(gfx::Font::Weight::BOLD);
smaller_font_list_ =
@ -127,10 +114,10 @@ void AutofillPopup::UpdatePopupBounds() {
gfx::Rect bounds(origin, element_bounds_.size());
gfx::Rect window_bounds = parent_->GetBoundsInScreen();
PopupViewCommon popup_view_common(window_bounds);
popup_bounds_ = popup_view_common.CalculatePopupBounds(
GetDesiredPopupWidth(), GetDesiredPopupHeight(), bounds,
gfx::NativeView(), base::i18n::IsRTL());
gfx::Size preferred_size =
gfx::Size(GetDesiredPopupWidth(), GetDesiredPopupHeight());
popup_bounds_ = CalculatePopupBounds(preferred_size, window_bounds, bounds,
base::i18n::IsRTL());
}
gfx::Rect AutofillPopup::popup_bounds_in_view() {

View file

@ -236,9 +236,9 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
keyEquivalent:@""]);
// If the menu item has an icon, set it.
gfx::Image icon;
if (model->GetIconAt(index, &icon) && !icon.IsEmpty())
[item setImage:icon.ToNSImage()];
ui::ImageModel icon = model->GetIconAt(index);
if (icon.IsImage())
[item setImage:icon.GetImage().ToNSImage()];
base::string16 toolTip = model->GetToolTipAt(index);
[item setToolTip:base::SysUTF16ToNSString(toolTip)];

View file

@ -10,12 +10,12 @@
#include "base/callback.h"
#include "base/files/file_util.h"
#include "base/strings/string_util.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/unresponsive_suppressor.h"
#include "shell/common/gin_converters/file_path_converter.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gtk/gtk_util.h"
namespace file_dialog {

View file

@ -8,14 +8,14 @@
#include "base/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "shell/browser/browser.h"
#include "shell/browser/native_window_observer.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/unresponsive_suppressor.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
#include "ui/gtk/gtk_util.h"
#define ANSI_FOREGROUND_RED "\x1b[31m"
#define ANSI_FOREGROUND_BLACK "\x1b[30m"

View file

@ -18,7 +18,7 @@
#include "ui/views/widget/widget.h"
#if defined(USE_X11)
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/gtk/gtk_util.h"
#endif
#if defined(OS_WIN)

View file

@ -180,8 +180,16 @@ void Clipboard::WriteBookmark(const base::string16& title,
gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) {
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
SkBitmap bitmap = clipboard->ReadImage(GetClipboardBuffer(args));
return gfx::Image::CreateFrom1xBitmap(bitmap);
base::Optional<gfx::Image> image;
clipboard->ReadImage(
GetClipboardBuffer(args),
base::Bind(
[](base::Optional<gfx::Image>* image, const SkBitmap& result) {
image->emplace(gfx::Image::CreateFrom1xBitmap(result));
},
&image));
DCHECK(image.has_value());
return image.value();
}
void Clipboard::WriteImage(const gfx::Image& image,

View file

@ -12,9 +12,9 @@
#include "base/environment.h"
#include "base/logging.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "electron/electron_version.h"
#include "shell/common/platform_util.h"
#include "ui/gtk/gtk_util.h"
namespace {

View file

@ -12,7 +12,7 @@
#include "base/nix/xdg_util.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/gtk/gtk_util.h"
#include "url/gurl.h"
#define ELECTRON_TRASH "ELECTRON_TRASH"