chore: bump chromium to e049d599a8332b9b2785b0178be74 (master) (#20314)
This commit is contained in:
parent
0090616f7b
commit
3ac3fbdbfb
94 changed files with 670 additions and 1213 deletions
|
@ -94,8 +94,9 @@ void DesktopCapturer::StartHandling(bool capture_window,
|
|||
content::DesktopMediaID::TYPE_WINDOW,
|
||||
content::desktop_capture::CreateWindowCapturer());
|
||||
window_capturer_->SetThumbnailSize(thumbnail_size);
|
||||
window_capturer_->AddObserver(this);
|
||||
window_capturer_->StartUpdating();
|
||||
window_capturer_->Update(base::BindOnce(
|
||||
&DesktopCapturer::UpdateSourcesList, weak_ptr_factory_.GetWeakPtr(),
|
||||
window_capturer_.get()));
|
||||
}
|
||||
|
||||
if (capture_screen) {
|
||||
|
@ -103,34 +104,13 @@ void DesktopCapturer::StartHandling(bool capture_window,
|
|||
content::DesktopMediaID::TYPE_SCREEN,
|
||||
content::desktop_capture::CreateScreenCapturer());
|
||||
screen_capturer_->SetThumbnailSize(thumbnail_size);
|
||||
screen_capturer_->AddObserver(this);
|
||||
screen_capturer_->StartUpdating();
|
||||
screen_capturer_->Update(base::BindOnce(
|
||||
&DesktopCapturer::UpdateSourcesList, weak_ptr_factory_.GetWeakPtr(),
|
||||
screen_capturer_.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DesktopCapturer::OnSourceAdded(DesktopMediaList* list, int index) {}
|
||||
|
||||
void DesktopCapturer::OnSourceRemoved(DesktopMediaList* list, int index) {}
|
||||
|
||||
void DesktopCapturer::OnSourceMoved(DesktopMediaList* list,
|
||||
int old_index,
|
||||
int new_index) {}
|
||||
|
||||
void DesktopCapturer::OnSourceNameChanged(DesktopMediaList* list, int index) {}
|
||||
|
||||
void DesktopCapturer::OnSourceThumbnailChanged(DesktopMediaList* list,
|
||||
int index) {}
|
||||
|
||||
void DesktopCapturer::OnSourceUnchanged(DesktopMediaList* list) {
|
||||
UpdateSourcesList(list);
|
||||
}
|
||||
|
||||
bool DesktopCapturer::ShouldScheduleNextRefresh(DesktopMediaList* list) {
|
||||
UpdateSourcesList(list);
|
||||
return false;
|
||||
}
|
||||
|
||||
void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
|
||||
if (capture_window_ &&
|
||||
list->GetMediaListType() == content::DesktopMediaID::TYPE_WINDOW) {
|
||||
|
|
|
@ -18,8 +18,7 @@ namespace electron {
|
|||
|
||||
namespace api {
|
||||
|
||||
class DesktopCapturer : public mate::TrackableObject<DesktopCapturer>,
|
||||
public DesktopMediaListObserver {
|
||||
class DesktopCapturer : public mate::TrackableObject<DesktopCapturer> {
|
||||
public:
|
||||
struct Source {
|
||||
DesktopMediaList::Source media_list_source;
|
||||
|
@ -44,17 +43,6 @@ class DesktopCapturer : public mate::TrackableObject<DesktopCapturer>,
|
|||
explicit DesktopCapturer(v8::Isolate* isolate);
|
||||
~DesktopCapturer() override;
|
||||
|
||||
// DesktopMediaListObserver overrides.
|
||||
void OnSourceAdded(DesktopMediaList* list, int index) override;
|
||||
void OnSourceRemoved(DesktopMediaList* list, int index) override;
|
||||
void OnSourceMoved(DesktopMediaList* list,
|
||||
int old_index,
|
||||
int new_index) override;
|
||||
void OnSourceNameChanged(DesktopMediaList* list, int index) override;
|
||||
void OnSourceThumbnailChanged(DesktopMediaList* list, int index) override;
|
||||
void OnSourceUnchanged(DesktopMediaList* list) override;
|
||||
bool ShouldScheduleNextRefresh(DesktopMediaList* list) override;
|
||||
|
||||
private:
|
||||
void UpdateSourcesList(DesktopMediaList* list);
|
||||
|
||||
|
@ -68,6 +56,8 @@ class DesktopCapturer : public mate::TrackableObject<DesktopCapturer>,
|
|||
bool using_directx_capturer_ = false;
|
||||
#endif // defined(OS_WIN)
|
||||
|
||||
base::WeakPtrFactory<DesktopCapturer> weak_ptr_factory_{this};
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DesktopCapturer);
|
||||
};
|
||||
|
||||
|
|
|
@ -526,13 +526,9 @@ void TopLevelWindow::SetAlwaysOnTop(bool top, mate::Arguments* args) {
|
|||
args->GetNext(&level);
|
||||
args->GetNext(&relative_level);
|
||||
|
||||
std::string error;
|
||||
ui::ZOrderLevel z_order =
|
||||
top ? ui::ZOrderLevel::kFloatingWindow : ui::ZOrderLevel::kNormal;
|
||||
window_->SetAlwaysOnTop(z_order, level, relative_level, &error);
|
||||
|
||||
if (!error.empty())
|
||||
args->ThrowError(error);
|
||||
window_->SetAlwaysOnTop(z_order, level, relative_level);
|
||||
}
|
||||
|
||||
bool TopLevelWindow::IsAlwaysOnTop() {
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "third_party/blink/public/platform/web_input_event.h"
|
||||
|
@ -938,7 +939,7 @@ void WebContents::DidAcquireFullscreen(content::RenderFrameHost* rfh) {
|
|||
set_fullscreen_frame(rfh);
|
||||
}
|
||||
|
||||
void WebContents::DocumentLoadedInFrame(
|
||||
void WebContents::DOMContentLoaded(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
if (!render_frame_host->GetParent())
|
||||
Emit("dom-ready");
|
||||
|
@ -2316,13 +2317,22 @@ double WebContents::GetZoomLevel() const {
|
|||
}
|
||||
|
||||
void WebContents::SetZoomFactor(double factor) {
|
||||
auto level = content::ZoomFactorToZoomLevel(factor);
|
||||
auto level = blink::PageZoomFactorToZoomLevel(factor);
|
||||
SetZoomLevel(level);
|
||||
}
|
||||
|
||||
double WebContents::GetZoomFactor() const {
|
||||
auto level = GetZoomLevel();
|
||||
return content::ZoomLevelToZoomFactor(level);
|
||||
return blink::PageZoomLevelToZoomFactor(level);
|
||||
}
|
||||
|
||||
void WebContents::SetZoomLimits(double min_zoom, double max_zoom) {
|
||||
// Round the double to avoid returning incorrect minimum/maximum zoom
|
||||
// percentages.
|
||||
int minimum_percent = round(blink::PageZoomLevelToZoomFactor(min_zoom) * 100);
|
||||
int maximum_percent = round(blink::PageZoomLevelToZoomFactor(max_zoom) * 100);
|
||||
web_contents()->SetMinimumZoomPercent(minimum_percent);
|
||||
web_contents()->SetMaximumZoomPercent(maximum_percent);
|
||||
}
|
||||
|
||||
void WebContents::SetTemporaryZoomLevel(double level) {
|
||||
|
|
|
@ -272,6 +272,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
double GetZoomLevel() const;
|
||||
void SetZoomFactor(double factor);
|
||||
double GetZoomFactor() const;
|
||||
void SetZoomLimits(double min_zoom, double max_zoom) override;
|
||||
|
||||
// Callback triggered on permission response.
|
||||
void OnEnterFullscreenModeForTab(content::WebContents* source,
|
||||
|
@ -426,8 +427,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
void RenderViewDeleted(content::RenderViewHost*) override;
|
||||
void RenderProcessGone(base::TerminationStatus status) override;
|
||||
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||
void DocumentLoadedInFrame(
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
void DOMContentLoaded(content::RenderFrameHost* render_frame_host) override;
|
||||
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url) override;
|
||||
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
|
|
|
@ -66,7 +66,7 @@ void GPUInfoManager::CompleteInfoFetcher(
|
|||
complete_info_promise_set_.emplace_back(std::move(promise));
|
||||
|
||||
if (NeedsCompleteGpuInfoCollection()) {
|
||||
gpu_data_manager_->RequestCompleteGpuInfoIfNeeded(
|
||||
gpu_data_manager_->RequestDxdiagDx12VulkanGpuInfoIfNeeded(
|
||||
content::kGpuInfoRequestAll, /* delayed */ false);
|
||||
} else {
|
||||
GPUInfoManager::OnGpuInfoUpdate();
|
||||
|
|
|
@ -1021,7 +1021,8 @@ AtomBrowserClient::CreateURLLoaderFactoryForNetworkRequests(
|
|||
network::mojom::NetworkContext* network_context,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
const url::Origin& request_initiator) {
|
||||
const url::Origin& request_initiator,
|
||||
const base::Optional<net::NetworkIsolationKey>& network_isolation_key) {
|
||||
auto render_process_id = process->GetID();
|
||||
auto it = process_preferences_.find(render_process_id);
|
||||
if (it != process_preferences_.end() && !it->second.web_security) {
|
||||
|
|
|
@ -186,7 +186,9 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
network::mojom::NetworkContext* network_context,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
const url::Origin& request_initiator) override;
|
||||
const url::Origin& request_initiator,
|
||||
const base::Optional<net::NetworkIsolationKey>& network_isolation_key)
|
||||
override;
|
||||
#if defined(OS_WIN)
|
||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
||||
RendererSpawnFlags flags) override;
|
||||
|
|
|
@ -129,8 +129,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
virtual bool IsClosable() = 0;
|
||||
virtual void SetAlwaysOnTop(ui::ZOrderLevel z_order,
|
||||
const std::string& level = "floating",
|
||||
int relativeLevel = 0,
|
||||
std::string* error = nullptr) = 0;
|
||||
int relativeLevel = 0) = 0;
|
||||
virtual ui::ZOrderLevel GetZOrderLevel() = 0;
|
||||
virtual void Center() = 0;
|
||||
virtual void Invalidate() = 0;
|
||||
|
|
|
@ -78,8 +78,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
bool IsClosable() override;
|
||||
void SetAlwaysOnTop(ui::ZOrderLevel z_order,
|
||||
const std::string& level,
|
||||
int relativeLevel,
|
||||
std::string* error) override;
|
||||
int relativeLevel) override;
|
||||
ui::ZOrderLevel GetZOrderLevel() override;
|
||||
void Center() override;
|
||||
void Invalidate() override;
|
||||
|
@ -148,6 +147,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
// Set the attribute of NSWindow while work around a bug of zoom button.
|
||||
void SetStyleMask(bool on, NSUInteger flag);
|
||||
void SetCollectionBehavior(bool on, NSUInteger flag);
|
||||
void SetWindowLevel(int level);
|
||||
|
||||
enum class TitleBarStyle {
|
||||
NORMAL,
|
||||
|
|
|
@ -875,52 +875,62 @@ bool NativeWindowMac::IsClosable() {
|
|||
}
|
||||
|
||||
void NativeWindowMac::SetAlwaysOnTop(ui::ZOrderLevel z_order,
|
||||
const std::string& level,
|
||||
int relativeLevel,
|
||||
std::string* error) {
|
||||
int windowLevel = NSNormalWindowLevel;
|
||||
bool level_changed = z_order != widget()->GetZOrderLevel();
|
||||
CGWindowLevel maxWindowLevel = CGWindowLevelForKey(kCGMaximumWindowLevelKey);
|
||||
CGWindowLevel minWindowLevel = CGWindowLevelForKey(kCGMinimumWindowLevelKey);
|
||||
|
||||
if (z_order != ui::ZOrderLevel::kNormal) {
|
||||
if (level == "floating") {
|
||||
windowLevel = NSFloatingWindowLevel;
|
||||
} else if (level == "torn-off-menu") {
|
||||
windowLevel = NSTornOffMenuWindowLevel;
|
||||
} else if (level == "modal-panel") {
|
||||
windowLevel = NSModalPanelWindowLevel;
|
||||
} else if (level == "main-menu") {
|
||||
windowLevel = NSMainMenuWindowLevel;
|
||||
} else if (level == "status") {
|
||||
windowLevel = NSStatusWindowLevel;
|
||||
} else if (level == "pop-up-menu") {
|
||||
windowLevel = NSPopUpMenuWindowLevel;
|
||||
} else if (level == "screen-saver") {
|
||||
windowLevel = NSScreenSaverWindowLevel;
|
||||
} else if (level == "dock") {
|
||||
// Deprecated by macOS, but kept for backwards compatibility
|
||||
windowLevel = NSDockWindowLevel;
|
||||
}
|
||||
const std::string& level_name,
|
||||
int relative_level) {
|
||||
if (z_order == ui::ZOrderLevel::kNormal) {
|
||||
SetWindowLevel(NSNormalWindowLevel);
|
||||
return;
|
||||
}
|
||||
|
||||
NSInteger newLevel = windowLevel + relativeLevel;
|
||||
if (newLevel >= minWindowLevel && newLevel <= maxWindowLevel) {
|
||||
was_maximizable_ = IsMaximizable();
|
||||
[window_ setLevel:newLevel];
|
||||
// Set level will make the zoom button revert to default, probably
|
||||
// a bug of Cocoa or macOS.
|
||||
[[window_ standardWindowButton:NSWindowZoomButton]
|
||||
setEnabled:was_maximizable_];
|
||||
} else {
|
||||
*error = std::string([[NSString
|
||||
stringWithFormat:@"relativeLevel must be between %d and %d",
|
||||
minWindowLevel, maxWindowLevel] UTF8String]);
|
||||
int level = NSNormalWindowLevel;
|
||||
if (level_name == "floating") {
|
||||
level = NSFloatingWindowLevel;
|
||||
} else if (level_name == "torn-off-menu") {
|
||||
level = NSTornOffMenuWindowLevel;
|
||||
} else if (level_name == "modal-panel") {
|
||||
level = NSModalPanelWindowLevel;
|
||||
} else if (level_name == "main-menu") {
|
||||
level = NSMainMenuWindowLevel;
|
||||
} else if (level_name == "status") {
|
||||
level = NSStatusWindowLevel;
|
||||
} else if (level_name == "pop-up-menu") {
|
||||
level = NSPopUpMenuWindowLevel;
|
||||
} else if (level_name == "screen-saver") {
|
||||
level = NSScreenSaverWindowLevel;
|
||||
} else if (level_name == "dock") {
|
||||
// Deprecated by macOS, but kept for backwards compatibility
|
||||
level = NSDockWindowLevel;
|
||||
}
|
||||
|
||||
SetWindowLevel(level + relative_level);
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetWindowLevel(int unbounded_level) {
|
||||
int level = std::min(
|
||||
std::max(unbounded_level, CGWindowLevelForKey(kCGMinimumWindowLevelKey)),
|
||||
CGWindowLevelForKey(kCGMaximumWindowLevelKey));
|
||||
ui::ZOrderLevel z_order_level = level == NSNormalWindowLevel
|
||||
? ui::ZOrderLevel::kNormal
|
||||
: ui::ZOrderLevel::kFloatingWindow;
|
||||
bool did_z_order_level_change = z_order_level != GetZOrderLevel();
|
||||
|
||||
was_maximizable_ = IsMaximizable();
|
||||
|
||||
// We need to explicitly keep the NativeWidget up to date, since it stores the
|
||||
// window level in a local variable, rather than reading it from the NSWindow.
|
||||
// Unfortunately, it results in a second setLevel call. It's not ideal, but we
|
||||
// don't expect this to cause any user-visible jank.
|
||||
widget()->SetZOrderLevel(z_order_level);
|
||||
[window_ setLevel:level];
|
||||
|
||||
// Set level will make the zoom button revert to default, probably
|
||||
// a bug of Cocoa or macOS.
|
||||
[[window_ standardWindowButton:NSWindowZoomButton]
|
||||
setEnabled:was_maximizable_];
|
||||
|
||||
// This must be notified at the very end or IsAlwaysOnTop
|
||||
// will not yet have been updated to reflect the new status
|
||||
if (level_changed)
|
||||
if (did_z_order_level_change)
|
||||
NativeWindow::NotifyWindowAlwaysOnTopChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -794,8 +794,7 @@ bool NativeWindowViews::IsClosable() {
|
|||
|
||||
void NativeWindowViews::SetAlwaysOnTop(ui::ZOrderLevel z_order,
|
||||
const std::string& level,
|
||||
int relativeLevel,
|
||||
std::string* error) {
|
||||
int relativeLevel) {
|
||||
bool level_changed = z_order != widget()->GetZOrderLevel();
|
||||
widget()->SetZOrderLevel(z_order);
|
||||
|
||||
|
|
|
@ -83,8 +83,7 @@ class NativeWindowViews : public NativeWindow,
|
|||
bool IsClosable() override;
|
||||
void SetAlwaysOnTop(ui::ZOrderLevel z_order,
|
||||
const std::string& level,
|
||||
int relativeLevel,
|
||||
std::string* error) override;
|
||||
int relativeLevel) override;
|
||||
ui::ZOrderLevel GetZOrderLevel() override;
|
||||
void Center() override;
|
||||
void Invalidate() override;
|
||||
|
|
|
@ -163,7 +163,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
|
|||
// store the current status window level to be restored in
|
||||
// windowDidDeminiaturize
|
||||
level_ = [window level];
|
||||
[window setLevel:NSNormalWindowLevel];
|
||||
shell_->SetWindowLevel(NSNormalWindowLevel);
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||
|
@ -173,7 +173,7 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
|
|||
|
||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||
[super windowDidDeminiaturize:notification];
|
||||
[shell_->GetNativeWindow().GetNativeNSWindow() setLevel:level_];
|
||||
shell_->SetWindowLevel(level_);
|
||||
shell_->NotifyWindowRestore();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
|
||||
#include "shell/common/platform_util.h"
|
||||
#include "third_party/blink/public/common/logging/logging_utils.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
|
||||
|
@ -122,15 +123,15 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
|
|||
}
|
||||
|
||||
double GetNextZoomLevel(double level, bool out) {
|
||||
double factor = content::ZoomLevelToZoomFactor(level);
|
||||
double factor = blink::PageZoomLevelToZoomFactor(level);
|
||||
size_t size = base::size(kPresetZoomFactors);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (!content::ZoomValuesEqual(kPresetZoomFactors[i], factor))
|
||||
if (!blink::PageZoomValuesEqual(kPresetZoomFactors[i], factor))
|
||||
continue;
|
||||
if (out && i > 0)
|
||||
return content::ZoomFactorToZoomLevel(kPresetZoomFactors[i - 1]);
|
||||
return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i - 1]);
|
||||
if (!out && i != size - 1)
|
||||
return content::ZoomFactorToZoomLevel(kPresetZoomFactors[i + 1]);
|
||||
return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i + 1]);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/common/application_info.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -18,38 +18,40 @@ TrayIconGtk::TrayIconGtk() = default;
|
|||
TrayIconGtk::~TrayIconGtk() = default;
|
||||
|
||||
void TrayIconGtk::SetImage(const gfx::Image& image) {
|
||||
image_ = image.AsImageSkia();
|
||||
if (icon_) {
|
||||
icon_->SetIcon(image.AsImageSkia());
|
||||
icon_->SetIcon(image_);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto toolTip = base::UTF8ToUTF16(GetApplicationName());
|
||||
icon_ = views::LinuxUI::instance()->CreateLinuxStatusIcon(
|
||||
image.AsImageSkia(), toolTip, Browser::Get()->GetName().c_str());
|
||||
tool_tip_ = base::UTF8ToUTF16(GetApplicationName());
|
||||
|
||||
icon_ = base::MakeRefCounted<StatusIconLinuxDbus>();
|
||||
icon_->SetIcon(image_);
|
||||
icon_->SetToolTip(tool_tip_);
|
||||
icon_->SetDelegate(this);
|
||||
}
|
||||
|
||||
void TrayIconGtk::SetToolTip(const std::string& tool_tip) {
|
||||
icon_->SetToolTip(base::UTF8ToUTF16(tool_tip));
|
||||
tool_tip_ = base::UTF8ToUTF16(tool_tip);
|
||||
icon_->SetToolTip(tool_tip_);
|
||||
}
|
||||
|
||||
void TrayIconGtk::SetContextMenu(AtomMenuModel* menu_model) {
|
||||
icon_->UpdatePlatformContextMenu(menu_model);
|
||||
icon_->UpdatePlatformContextMenu(menu_model_);
|
||||
menu_model_ = menu_model;
|
||||
}
|
||||
|
||||
const gfx::ImageSkia& TrayIconGtk::GetImage() const {
|
||||
NOTREACHED();
|
||||
return dummy_image_;
|
||||
return image_;
|
||||
}
|
||||
|
||||
const base::string16& TrayIconGtk::GetToolTip() const {
|
||||
NOTREACHED();
|
||||
return dummy_string_;
|
||||
return tool_tip_;
|
||||
}
|
||||
|
||||
ui::MenuModel* TrayIconGtk::GetMenuModel() const {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
return menu_model_;
|
||||
}
|
||||
|
||||
void TrayIconGtk::OnImplInitializationFailed() {}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h"
|
||||
#include "shell/browser/ui/tray_icon.h"
|
||||
#include "ui/views/linux_ui/status_icon_linux.h"
|
||||
|
||||
|
@ -38,10 +39,10 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
|
|||
void OnImplInitializationFailed() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<views::StatusIconLinux> icon_;
|
||||
|
||||
gfx::ImageSkia dummy_image_;
|
||||
base::string16 dummy_string_;
|
||||
scoped_refptr<StatusIconLinuxDbus> icon_;
|
||||
gfx::ImageSkia image_;
|
||||
base::string16 tool_tip_;
|
||||
ui::MenuModel* menu_model_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
|
||||
};
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/page_type.h"
|
||||
#include "content/public/common/page_zoom.h"
|
||||
#include "net/base/url_util.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
WebContentsZoomController::WebContentsZoomController(
|
||||
content::WebContents* web_contents)
|
||||
: content::WebContentsObserver(web_contents) {
|
||||
default_zoom_factor_ = content::kEpsilon;
|
||||
default_zoom_factor_ = kPageZoomEpsilon;
|
||||
host_zoom_map_ = content::HostZoomMap::GetForWebContents(web_contents);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ void WebContentsZoomController::SetEmbedderZoomController(
|
|||
|
||||
void WebContentsZoomController::SetZoomLevel(double level) {
|
||||
if (!web_contents()->GetRenderViewHost()->IsRenderViewLive() ||
|
||||
content::ZoomValuesEqual(GetZoomLevel(), level) ||
|
||||
blink::PageZoomValuesEqual(GetZoomLevel(), level) ||
|
||||
zoom_mode_ == ZoomMode::DISABLED)
|
||||
return;
|
||||
|
||||
|
@ -247,7 +247,7 @@ void WebContentsZoomController::RenderFrameHostChanged(
|
|||
|
||||
void WebContentsZoomController::SetZoomFactorOnNavigationIfNeeded(
|
||||
const GURL& url) {
|
||||
if (content::ZoomValuesEqual(GetDefaultZoomFactor(), content::kEpsilon))
|
||||
if (blink::PageZoomValuesEqual(GetDefaultZoomFactor(), kPageZoomEpsilon))
|
||||
return;
|
||||
|
||||
if (host_zoom_map_->UsesTemporaryZoomLevel(old_process_id_, old_view_id_)) {
|
||||
|
@ -268,11 +268,11 @@ void WebContentsZoomController::SetZoomFactorOnNavigationIfNeeded(
|
|||
std::string host = net::GetHostOrSpecFromURL(url);
|
||||
std::string scheme = url.scheme();
|
||||
double zoom_factor = GetDefaultZoomFactor();
|
||||
double zoom_level = content::ZoomFactorToZoomLevel(zoom_factor);
|
||||
double zoom_level = blink::PageZoomFactorToZoomLevel(zoom_factor);
|
||||
if (host_zoom_map_->HasZoomLevel(scheme, host)) {
|
||||
zoom_level = host_zoom_map_->GetZoomLevelForHostAndScheme(scheme, host);
|
||||
}
|
||||
if (content::ZoomValuesEqual(zoom_level, GetZoomLevel()))
|
||||
if (blink::PageZoomValuesEqual(zoom_level, GetZoomLevel()))
|
||||
return;
|
||||
|
||||
SetZoomLevel(zoom_level);
|
||||
|
|
|
@ -103,6 +103,8 @@ class WebContentsZoomController
|
|||
// kZoomFactor.
|
||||
double default_zoom_factor_ = 0;
|
||||
|
||||
const double kPageZoomEpsilon = 0.001;
|
||||
|
||||
int old_process_id_ = -1;
|
||||
int old_view_id_ = -1;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "shell/browser/api/atom_api_web_contents.h"
|
||||
#include "shell/common/native_mate_converters/gurl_converter.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -76,7 +77,7 @@ void WebViewGuestDelegate::OnZoomLevelChanged(
|
|||
api_web_contents_->GetZoomController()->SetZoomLevel(level);
|
||||
}
|
||||
// Change the default zoom factor to match the embedders' new zoom level.
|
||||
double zoom_factor = content::ZoomLevelToZoomFactor(level);
|
||||
double zoom_factor = blink::PageZoomFactorToZoomLevel(level);
|
||||
api_web_contents_->GetZoomController()->SetDefaultZoomFactor(zoom_factor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "components/prefs/pref_service_factory.h"
|
||||
#include "components/prefs/scoped_user_pref_update.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/page_zoom.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -53,7 +53,7 @@ ZoomLevelDelegate::ZoomLevelDelegate(PrefService* pref_service,
|
|||
ZoomLevelDelegate::~ZoomLevelDelegate() = default;
|
||||
|
||||
void ZoomLevelDelegate::SetDefaultZoomLevelPref(double level) {
|
||||
if (content::ZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel()))
|
||||
if (blink::PageZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel()))
|
||||
return;
|
||||
|
||||
DictionaryPrefUpdate update(pref_service_, kPartitionDefaultZoomLevel);
|
||||
|
@ -83,7 +83,7 @@ void ZoomLevelDelegate::OnZoomLevelChanged(
|
|||
DCHECK(host_zoom_dictionaries);
|
||||
|
||||
bool modification_is_removal =
|
||||
content::ZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel());
|
||||
blink::PageZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel());
|
||||
|
||||
base::DictionaryValue* host_zoom_dictionary = nullptr;
|
||||
if (!host_zoom_dictionaries->GetDictionary(partition_key_,
|
||||
|
@ -117,8 +117,8 @@ void ZoomLevelDelegate::ExtractPerHostZoomLevels(
|
|||
// will ignore type B values, thus, to have consistency with HostZoomMap's
|
||||
// internal state, these values must also be removed from Prefs.
|
||||
if (host.empty() || !has_valid_zoom_level ||
|
||||
content::ZoomValuesEqual(zoom_level,
|
||||
host_zoom_map_->GetDefaultZoomLevel())) {
|
||||
blink::PageZoomValuesEqual(zoom_level,
|
||||
host_zoom_map_->GetDefaultZoomLevel())) {
|
||||
keys_to_remove.push_back(host);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ interface ElectronBrowser {
|
|||
|
||||
SetTemporaryZoomLevel(double zoom_level);
|
||||
|
||||
SetZoomLimits(double min_zoom, double max_zoom);
|
||||
|
||||
[Sync]
|
||||
DoGetZoomLevel() => (double result);
|
||||
};
|
||||
|
|
|
@ -337,7 +337,7 @@ void FillRequestDetails(base::DictionaryValue* details,
|
|||
|
||||
void GetUploadData(base::ListValue* upload_data_list,
|
||||
const net::URLRequest* request) {
|
||||
const net::UploadDataStream* upload_data = request->get_upload();
|
||||
const net::UploadDataStream* upload_data = request->get_upload_for_testing();
|
||||
if (!upload_data)
|
||||
return;
|
||||
const std::vector<std::unique_ptr<net::UploadElementReader>>* readers =
|
||||
|
|
|
@ -454,9 +454,9 @@ v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags) {
|
|||
return mate::ConvertToV8(isolate, dict);
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStat>::ToV8(
|
||||
v8::Local<v8::Value> Converter<blink::WebCacheResourceTypeStat>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::WebCache::ResourceTypeStat& stat) {
|
||||
const blink::WebCacheResourceTypeStat& stat) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("count", static_cast<uint32_t>(stat.count));
|
||||
dict.Set("size", static_cast<double>(stat.size));
|
||||
|
@ -464,9 +464,9 @@ v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStat>::ToV8(
|
|||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> Converter<blink::WebCache::ResourceTypeStats>::ToV8(
|
||||
v8::Local<v8::Value> Converter<blink::WebCacheResourceTypeStats>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::WebCache::ResourceTypeStats& stats) {
|
||||
const blink::WebCacheResourceTypeStats& stats) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("images", stats.images);
|
||||
dict.Set("scripts", stats.scripts);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "native_mate/converter.h"
|
||||
#include "third_party/blink/public/common/messaging/cloneable_message.h"
|
||||
#include "third_party/blink/public/platform/web_cache.h"
|
||||
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
|
||||
#include "third_party/blink/public/platform/web_input_event.h"
|
||||
#include "third_party/blink/public/web/web_context_menu_data.h"
|
||||
|
||||
|
@ -110,17 +110,16 @@ struct Converter<blink::WebContextMenuData::InputFieldType> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct Converter<blink::WebCache::ResourceTypeStat> {
|
||||
static v8::Local<v8::Value> ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::WebCache::ResourceTypeStat& stat);
|
||||
struct Converter<blink::WebCacheResourceTypeStat> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const blink::WebCacheResourceTypeStat& stat);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<blink::WebCache::ResourceTypeStats> {
|
||||
struct Converter<blink::WebCacheResourceTypeStats> {
|
||||
static v8::Local<v8::Value> ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::WebCache::ResourceTypeStats& stats);
|
||||
const blink::WebCacheResourceTypeStats& stats);
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/promise_util.h"
|
||||
#include "shell/renderer/api/atom_api_spell_check_client.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
|
||||
#include "third_party/blink/public/platform/web_cache.h"
|
||||
#include "third_party/blink/public/platform/web_isolated_world_info.h"
|
||||
#include "third_party/blink/public/web/web_custom_element.h"
|
||||
|
@ -249,11 +251,11 @@ double GetZoomLevel(v8::Local<v8::Value> window) {
|
|||
}
|
||||
|
||||
void SetZoomFactor(v8::Local<v8::Value> window, double factor) {
|
||||
SetZoomLevel(window, blink::WebView::ZoomFactorToZoomLevel(factor));
|
||||
SetZoomLevel(window, blink::PageZoomFactorToZoomLevel(factor));
|
||||
}
|
||||
|
||||
double GetZoomFactor(v8::Local<v8::Value> window) {
|
||||
return blink::WebView::ZoomLevelToZoomFactor(GetZoomLevel(window));
|
||||
return blink::PageZoomLevelToZoomFactor(GetZoomLevel(window));
|
||||
}
|
||||
|
||||
void SetVisualZoomLevelLimits(v8::Local<v8::Value> window,
|
||||
|
@ -267,8 +269,12 @@ void SetVisualZoomLevelLimits(v8::Local<v8::Value> window,
|
|||
void SetLayoutZoomLevelLimits(v8::Local<v8::Value> window,
|
||||
double min_level,
|
||||
double max_level) {
|
||||
blink::WebFrame* web_frame = GetRenderFrame(window)->GetWebFrame();
|
||||
web_frame->View()->ZoomLimitsChanged(min_level, max_level);
|
||||
content::RenderFrame* render_frame = GetRenderFrame(window);
|
||||
mojom::ElectronBrowserPtr browser_ptr;
|
||||
render_frame->GetRemoteInterfaces()->GetInterface(
|
||||
mojo::MakeRequest(&browser_ptr));
|
||||
|
||||
browser_ptr->SetZoomLimits(min_level, max_level);
|
||||
}
|
||||
|
||||
void AllowGuestViewElementDefinition(v8::Isolate* isolate,
|
||||
|
@ -455,8 +461,8 @@ void SetIsolatedWorldInfo(v8::Local<v8::Value> window,
|
|||
GetRenderFrame(window)->GetWebFrame()->SetIsolatedWorldInfo(world_id, info);
|
||||
}
|
||||
|
||||
blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate) {
|
||||
blink::WebCache::ResourceTypeStats stats;
|
||||
blink::WebCacheResourceTypeStats GetResourceUsage(v8::Isolate* isolate) {
|
||||
blink::WebCacheResourceTypeStats stats;
|
||||
blink::WebCache::GetResourceTypeStats(&stats);
|
||||
return stats;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue