electron/shell/browser/native_window.cc

619 lines
18 KiB
C++
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-04-12 07:04:46 +00:00
// found in the LICENSE file.
#include "shell/browser/native_window.h"
2013-04-12 07:04:46 +00:00
#include <algorithm>
2013-04-12 07:04:46 +00:00
#include <string>
#include <utility>
#include <vector>
2013-04-12 07:04:46 +00:00
2019-08-29 06:57:11 +00:00
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "shell/browser/browser.h"
#include "shell/browser/window_list.h"
#include "shell/common/color_util.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/persistent_dictionary.h"
#include "shell/common/options_switches.h"
#include "ui/views/widget/widget.h"
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
#include "ui/display/win/screen_win.h"
#endif
2013-04-12 07:04:46 +00:00
namespace electron {
2013-04-12 07:04:46 +00:00
namespace {
#if defined(OS_WIN)
2018-05-12 17:51:19 +00:00
gfx::Size GetExpandedWindowSize(const NativeWindow* window, gfx::Size size) {
if (!window->transparent() || !ui::win::IsAeroGlassEnabled())
return size;
2018-05-12 17:51:19 +00:00
gfx::Size min_size = display::win::ScreenWin::ScreenToDIPSize(
window->GetAcceleratedWidget(), gfx::Size(64, 64));
2018-05-12 17:51:19 +00:00
// Some AMD drivers can't display windows that are less than 64x64 pixels,
// so expand them to be at least that size. http://crbug.com/286609
gfx::Size expanded(std::max(size.width(), min_size.width()),
std::max(size.height(), min_size.height()));
return expanded;
}
#endif
} // namespace
NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
NativeWindow* parent)
: widget_(new views::Widget), parent_(parent), weak_factory_(this) {
options.Get(options::kFrame, &has_frame_);
options.Get(options::kTransparent, &transparent_);
options.Get(options::kEnableLargerThanScreen, &enable_larger_than_screen_);
if (parent)
options.Get("modal", &is_modal_);
WindowList::AddWindow(this);
2013-04-12 07:04:46 +00:00
}
NativeWindow::~NativeWindow() {
// It's possible that the windows gets destroyed before it's closed, in that
// case we need to ensure the Widget delegate gets destroyed and
// OnWindowClosed message is still notified.
if (widget_->widget_delegate())
widget_->OnNativeWidgetDestroyed();
NotifyWindowClosed();
2013-04-12 07:04:46 +00:00
}
void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
2013-04-12 07:04:46 +00:00
// Setup window from options.
int x = -1, y = -1;
bool center;
if (options.Get(options::kX, &x) && options.Get(options::kY, &y)) {
SetPosition(gfx::Point(x, y));
2017-10-30 18:19:50 +00:00
2017-10-31 17:31:05 +00:00
#if defined(OS_WIN)
2017-11-01 18:30:32 +00:00
// FIXME(felixrieseberg): Dirty, dirty workaround for
2017-10-30 18:19:50 +00:00
// https://github.com/electron/electron/issues/10862
// Somehow, we need to call `SetBounds` twice to get
// usable results. The root cause is still unknown.
SetPosition(gfx::Point(x, y));
#endif
} else if (options.Get(options::kCenter, &center) && center) {
Center();
2013-04-12 07:04:46 +00:00
}
bool use_content_size = false;
options.Get(options::kUseContentSize, &use_content_size);
// On Linux and Window we may already have maximum size defined.
extensions::SizeConstraints size_constraints(
use_content_size ? GetContentSizeConstraints() : GetSizeConstraints());
int min_height = 0, min_width = 0;
if (options.Get(options::kMinHeight, &min_height) |
options.Get(options::kMinWidth, &min_width)) {
size_constraints.set_minimum_size(gfx::Size(min_width, min_height));
2013-04-12 07:04:46 +00:00
}
int max_height = INT_MAX, max_width = INT_MAX;
if (options.Get(options::kMaxHeight, &max_height) |
options.Get(options::kMaxWidth, &max_width)) {
size_constraints.set_maximum_size(gfx::Size(max_width, max_height));
}
if (use_content_size) {
SetContentSizeConstraints(size_constraints);
} else {
SetSizeConstraints(size_constraints);
2013-04-12 07:04:46 +00:00
}
#if defined(OS_WIN) || defined(USE_X11)
bool resizable;
if (options.Get(options::kResizable, &resizable)) {
SetResizable(resizable);
}
bool closable;
if (options.Get(options::kClosable, &closable)) {
SetClosable(closable);
}
#endif
2016-01-23 10:23:18 +00:00
bool movable;
2016-01-23 11:35:30 +00:00
if (options.Get(options::kMovable, &movable)) {
2016-01-23 10:23:18 +00:00
SetMovable(movable);
}
2016-01-23 10:55:12 +00:00
bool has_shadow;
if (options.Get(options::kHasShadow, &has_shadow)) {
SetHasShadow(has_shadow);
}
2017-09-29 02:26:02 +00:00
double opacity;
if (options.Get(options::kOpacity, &opacity)) {
SetOpacity(opacity);
}
2013-04-12 07:04:46 +00:00
bool top;
if (options.Get(options::kAlwaysOnTop, &top) && top) {
SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
2013-04-12 07:04:46 +00:00
}
bool fullscreenable = true;
bool fullscreen = false;
if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
// Disable fullscreen button if 'fullscreen' is specified to false.
2018-04-18 01:55:30 +00:00
#if defined(OS_MACOSX)
fullscreenable = false;
2018-04-18 01:55:30 +00:00
#endif
}
2016-03-05 12:54:41 +00:00
// Overriden by 'fullscreenable'.
options.Get(options::kFullScreenable, &fullscreenable);
SetFullScreenable(fullscreenable);
2016-03-05 12:54:41 +00:00
if (fullscreen) {
2014-11-25 06:34:14 +00:00
SetFullScreen(true);
2016-03-05 12:54:41 +00:00
}
bool skip;
if (options.Get(options::kSkipTaskbar, &skip)) {
SetSkipTaskbar(skip);
}
2013-04-12 07:04:46 +00:00
bool kiosk;
if (options.Get(options::kKiosk, &kiosk) && kiosk) {
2013-04-12 07:04:46 +00:00
SetKiosk(kiosk);
}
#if defined(OS_MACOSX)
std::string type;
if (options.Get(options::kVibrancyType, &type)) {
SetVibrancy(type);
}
#endif
2015-10-23 03:35:33 +00:00
std::string color;
if (options.Get(options::kBackgroundColor, &color)) {
SetBackgroundColor(ParseHexColor(color));
} else if (!transparent()) {
// For normal window, use white as default background.
SetBackgroundColor(SK_ColorWHITE);
2015-10-23 03:35:33 +00:00
}
2016-06-08 21:17:33 +00:00
std::string title(Browser::Get()->GetName());
options.Get(options::kTitle, &title);
2013-04-12 07:04:46 +00:00
SetTitle(title);
// Then show it.
bool show = true;
options.Get(options::kShow, &show);
2015-10-01 09:46:11 +00:00
if (show)
2013-04-12 07:04:46 +00:00
Show();
}
bool NativeWindow::IsClosed() const {
return is_closed_;
}
2016-01-15 04:54:12 +00:00
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
SetBounds(gfx::Rect(GetPosition(), size), animate);
}
gfx::Size NativeWindow::GetSize() {
return GetBounds().size();
}
2016-01-15 04:54:12 +00:00
void NativeWindow::SetPosition(const gfx::Point& position, bool animate) {
SetBounds(gfx::Rect(position, GetSize()), animate);
}
gfx::Point NativeWindow::GetPosition() {
return GetBounds().origin();
}
2016-01-15 04:54:12 +00:00
void NativeWindow::SetContentSize(const gfx::Size& size, bool animate) {
SetSize(ContentBoundsToWindowBounds(gfx::Rect(size)).size(), animate);
}
gfx::Size NativeWindow::GetContentSize() {
return GetContentBounds().size();
2016-08-04 19:02:24 +00:00
}
void NativeWindow::SetContentBounds(const gfx::Rect& bounds, bool animate) {
SetBounds(ContentBoundsToWindowBounds(bounds), animate);
}
gfx::Rect NativeWindow::GetContentBounds() {
return WindowBoundsToContentBounds(GetBounds());
}
bool NativeWindow::IsNormal() {
return !IsMinimized() && !IsMaximized() && !IsFullscreen();
}
void NativeWindow::SetSizeConstraints(
const extensions::SizeConstraints& window_constraints) {
extensions::SizeConstraints content_constraints(GetContentSizeConstraints());
if (window_constraints.HasMaximumSize()) {
gfx::Rect max_bounds = WindowBoundsToContentBounds(
gfx::Rect(window_constraints.GetMaximumSize()));
content_constraints.set_maximum_size(max_bounds.size());
}
if (window_constraints.HasMinimumSize()) {
gfx::Rect min_bounds = WindowBoundsToContentBounds(
gfx::Rect(window_constraints.GetMinimumSize()));
content_constraints.set_minimum_size(min_bounds.size());
}
SetContentSizeConstraints(content_constraints);
}
2017-05-21 18:57:19 +00:00
extensions::SizeConstraints NativeWindow::GetSizeConstraints() const {
extensions::SizeConstraints content_constraints = GetContentSizeConstraints();
extensions::SizeConstraints window_constraints;
if (content_constraints.HasMaximumSize()) {
gfx::Rect max_bounds = ContentBoundsToWindowBounds(
gfx::Rect(content_constraints.GetMaximumSize()));
2016-08-04 19:14:23 +00:00
window_constraints.set_maximum_size(max_bounds.size());
}
if (content_constraints.HasMinimumSize()) {
gfx::Rect min_bounds = ContentBoundsToWindowBounds(
gfx::Rect(content_constraints.GetMinimumSize()));
window_constraints.set_minimum_size(min_bounds.size());
}
return window_constraints;
}
void NativeWindow::SetContentSizeConstraints(
const extensions::SizeConstraints& size_constraints) {
size_constraints_ = size_constraints;
}
2017-05-21 18:57:19 +00:00
extensions::SizeConstraints NativeWindow::GetContentSizeConstraints() const {
return size_constraints_;
}
void NativeWindow::SetMinimumSize(const gfx::Size& size) {
extensions::SizeConstraints size_constraints;
size_constraints.set_minimum_size(size);
SetSizeConstraints(size_constraints);
}
2017-05-21 18:57:19 +00:00
gfx::Size NativeWindow::GetMinimumSize() const {
return GetSizeConstraints().GetMinimumSize();
}
void NativeWindow::SetMaximumSize(const gfx::Size& size) {
extensions::SizeConstraints size_constraints;
size_constraints.set_maximum_size(size);
SetSizeConstraints(size_constraints);
}
2017-05-21 18:57:19 +00:00
gfx::Size NativeWindow::GetMaximumSize() const {
return GetSizeConstraints().GetMaximumSize();
}
gfx::Size NativeWindow::GetContentMinimumSize() const {
return GetContentSizeConstraints().GetMinimumSize();
}
gfx::Size NativeWindow::GetContentMaximumSize() const {
gfx::Size maximum_size = GetContentSizeConstraints().GetMaximumSize();
#if defined(OS_WIN)
return GetContentSizeConstraints().HasMaximumSize()
? GetExpandedWindowSize(this, maximum_size)
: maximum_size;
2018-05-12 20:05:25 +00:00
#else
return maximum_size;
#endif
}
void NativeWindow::SetSheetOffset(const double offsetX, const double offsetY) {
sheet_offset_x_ = offsetX;
sheet_offset_y_ = offsetY;
}
double NativeWindow::GetSheetOffsetX() {
return sheet_offset_x_;
}
double NativeWindow::GetSheetOffsetY() {
return sheet_offset_y_;
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetRepresentedFilename(const std::string& filename) {}
std::string NativeWindow::GetRepresentedFilename() {
return "";
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetDocumentEdited(bool edited) {}
2014-08-21 13:00:49 +00:00
bool NativeWindow::IsDocumentEdited() {
return false;
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetFocusable(bool focusable) {}
2016-06-13 08:10:28 +00:00
void NativeWindow::SetMenu(ElectronMenuModel* menu) {}
void NativeWindow::SetParentWindow(NativeWindow* parent) {
parent_ = parent;
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetAutoHideCursor(bool auto_hide) {}
2018-04-18 01:55:30 +00:00
void NativeWindow::SelectPreviousTab() {}
2018-04-18 01:55:30 +00:00
void NativeWindow::SelectNextTab() {}
2018-04-18 01:55:30 +00:00
void NativeWindow::MergeAllWindows() {}
2018-04-18 01:55:30 +00:00
void NativeWindow::MoveTabToNewWindow() {}
2018-04-18 01:55:30 +00:00
void NativeWindow::ToggleTabBar() {}
bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
return true; // for non-Mac platforms
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetVibrancy(const std::string& filename) {}
void NativeWindow::SetTouchBar(
std::vector<gin_helper::PersistentDictionary> items) {}
2018-04-18 01:55:30 +00:00
void NativeWindow::RefreshTouchBarItem(const std::string& item_id) {}
2017-03-29 19:41:49 +00:00
void NativeWindow::SetEscapeTouchBarItem(
gin_helper::PersistentDictionary item) {}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetAutoHideMenuBar(bool auto_hide) {}
bool NativeWindow::IsMenuBarAutoHide() {
return false;
}
2018-04-18 01:55:30 +00:00
void NativeWindow::SetMenuBarVisibility(bool visible) {}
bool NativeWindow::IsMenuBarVisible() {
return true;
}
bool NativeWindow::SetWindowButtonVisibility(bool visible) {
return false;
}
double NativeWindow::GetAspectRatio() {
return aspect_ratio_;
}
gfx::Size NativeWindow::GetAspectRatioExtraSize() {
return aspect_ratio_extraSize_;
}
void NativeWindow::SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) {
aspect_ratio_ = aspect_ratio;
aspect_ratio_extraSize_ = extra_size;
}
2016-10-14 16:42:50 +00:00
void NativeWindow::PreviewFile(const std::string& path,
2018-04-18 01:55:30 +00:00
const std::string& display_name) {}
2016-10-12 01:08:01 +00:00
2018-04-18 01:55:30 +00:00
void NativeWindow::CloseFilePreview() {}
2016-11-21 18:30:13 +00:00
void NativeWindow::NotifyWindowRequestPreferredWith(int* width) {
for (NativeWindowObserver& observer : observers_)
observer.RequestPreferredWidth(width);
}
void NativeWindow::NotifyWindowCloseButtonClicked() {
// First ask the observers whether we want to close.
bool prevent_default = false;
for (NativeWindowObserver& observer : observers_)
observer.WillCloseWindow(&prevent_default);
if (prevent_default) {
WindowList::WindowCloseCancelled(this);
return;
}
// Then ask the observers how should we close the window.
for (NativeWindowObserver& observer : observers_)
observer.OnCloseButtonClicked(&prevent_default);
if (prevent_default)
return;
CloseImmediately();
}
void NativeWindow::NotifyWindowClosed() {
if (is_closed_)
return;
WindowList::RemoveWindow(this);
is_closed_ = true;
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowClosed();
}
2017-04-21 20:45:30 +00:00
void NativeWindow::NotifyWindowEndSession() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowEndSession();
}
void NativeWindow::NotifyWindowBlur() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowBlur();
}
void NativeWindow::NotifyWindowFocus() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowFocus();
}
void NativeWindow::NotifyWindowShow() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowShow();
}
void NativeWindow::NotifyWindowHide() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowHide();
}
2014-11-25 04:43:25 +00:00
void NativeWindow::NotifyWindowMaximize() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowMaximize();
2014-11-25 04:43:25 +00:00
}
void NativeWindow::NotifyWindowUnmaximize() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowUnmaximize();
2014-11-25 04:43:25 +00:00
}
void NativeWindow::NotifyWindowMinimize() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowMinimize();
2014-11-25 04:43:25 +00:00
}
void NativeWindow::NotifyWindowRestore() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowRestore();
2014-11-25 04:43:25 +00:00
}
void NativeWindow::NotifyWindowWillResize(const gfx::Rect& new_bounds,
bool* prevent_default) {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowWillResize(new_bounds, prevent_default);
}
void NativeWindow::NotifyWindowWillMove(const gfx::Rect& new_bounds,
bool* prevent_default) {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowWillMove(new_bounds, prevent_default);
}
2015-05-09 15:55:10 +00:00
void NativeWindow::NotifyWindowResize() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowResize();
2015-05-09 15:55:10 +00:00
}
void NativeWindow::NotifyWindowMove() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowMove();
2015-05-09 15:55:10 +00:00
}
2015-05-20 08:37:13 +00:00
void NativeWindow::NotifyWindowMoved() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowMoved();
2015-05-20 08:37:13 +00:00
}
2014-11-25 04:43:25 +00:00
void NativeWindow::NotifyWindowEnterFullScreen() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowEnterFullScreen();
2014-11-25 04:43:25 +00:00
}
2016-01-22 00:31:09 +00:00
void NativeWindow::NotifyWindowScrollTouchBegin() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowScrollTouchBegin();
}
2016-01-22 00:31:09 +00:00
void NativeWindow::NotifyWindowScrollTouchEnd() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowScrollTouchEnd();
}
void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSwipe(direction);
}
void NativeWindow::NotifyWindowRotateGesture(float rotation) {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowRotateGesture(rotation);
}
void NativeWindow::NotifyWindowSheetBegin() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetBegin();
}
void NativeWindow::NotifyWindowSheetEnd() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowSheetEnd();
}
2014-11-25 04:43:25 +00:00
void NativeWindow::NotifyWindowLeaveFullScreen() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowLeaveFullScreen();
2014-11-25 04:43:25 +00:00
}
void NativeWindow::NotifyWindowEnterHtmlFullScreen() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowEnterHtmlFullScreen();
}
void NativeWindow::NotifyWindowLeaveHtmlFullScreen() {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowLeaveHtmlFullScreen();
}
void NativeWindow::NotifyWindowAlwaysOnTopChanged() {
for (NativeWindowObserver& observer : observers_)
observer.OnWindowAlwaysOnTopChanged();
}
void NativeWindow::NotifyWindowExecuteAppCommand(const std::string& command) {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnExecuteAppCommand(command);
}
void NativeWindow::NotifyTouchBarItemInteraction(
const std::string& item_id,
const base::DictionaryValue& details) {
2017-02-27 17:20:25 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnTouchBarItemResult(item_id, details);
2017-02-27 17:20:25 +00:00
}
void NativeWindow::NotifyNewWindowForTab() {
2018-04-18 01:55:30 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnNewWindowForTab();
}
2015-10-27 01:12:01 +00:00
#if defined(OS_WIN)
2018-04-18 01:55:30 +00:00
void NativeWindow::NotifyWindowMessage(UINT message,
WPARAM w_param,
LPARAM l_param) {
2017-01-24 03:34:39 +00:00
for (NativeWindowObserver& observer : observers_)
observer.OnWindowMessage(message, w_param, l_param);
2015-10-27 01:12:01 +00:00
}
#endif
chore: bump chromium to 279aeeec3c9fe2237bc31f776f269 (master) (#21521) * chore: bump chromium in DEPS to 46d2d82e84d73806da623c5333dae4dd218172df * chore: bump chromium in DEPS to cbafe74731a5d1e59844ca59e0fc28f4a5f80a33 * chore: bump chromium in DEPS to d5dcd6b5cc76f4e1732083d775cdd7b533f0abe9 * Update patches * update for lint * Fix compilation errors * chore: bump chromium in DEPS to 1c19360fdaaf65d4ed006736c7f9804104095990 * Replace removed constant * chore: bump chromium in DEPS to 3b6639f5da26c1772c5d4f3ba634aca65df75fec * chore: bump chromium in DEPS to cc6b1b930d4b5eca06701820dac54fa0f41e8999 * chore: bump chromium in DEPS to 7d1445641ad1032c67f731ba6ff7798f29349ade * chore: bump chromium in DEPS to 6f7e5e79cefe982ad84a88927565a88db2e592be * chore: bump chromium in DEPS to bfb25dafff19cb41bf9781331d19ef0be819d1e4 * chore: bump chromium in DEPS to 1a8196b39f0e0cdc4935fd122fff5625d5fab06e * chore: bump chromium in DEPS to 9a03d8d2bb38ad8c0cbb9550ca81b2f94ff60c15 * chore: bump chromium in DEPS to 4c67f3505dab2d5457adb418cd3270a4f3236fd0 * chore: bump chromium in DEPS to 652394e7626fc1ae895a53fb34c64070494e648e * chore: bump chromium in DEPS to 07653652c58cc019af7f833bd63eb0c2eceaab5e * chore: bump chromium in DEPS to 451a1c5fec1fb073a5bae12a033bb342c72c905f * chore: bump chromium in DEPS to 86cdba00e233899a232868b412b333d08db63478 * chore: bump chromium in DEPS to 7c322faad1aee8abef2330d74aabf09ecf8c11af * Update patches * chore: bump chromium in DEPS to d0044fae7efc29eb201cfdd5fdbed77d48aba212 * Replace IsProcessingUserGesture with HasTransientUserActivation https://chromium.googlesource.com/chromium/src/+/4baa9a6e85e6c1784fd20d196c1c3c85fdb40101 * Fix 10.15 sdk build https://chromium.googlesource.com/chromium/src/+/0eaa6db358ca97b1cd358934068ade9a249c83db * Remove CancelPrerender https://chromium.googlesource.com/chromium/src/+/5eb33297194c3d3d6a7f2d744b3811033463194e * Remove no longer used WebFloatPoint https://chromium.googlesource.com/chromium/src/+/43ab96ce6bfc78440e5b1617a9974386a54c750c * Use base::span<const uint8_t> for devtools messages in content/public https://chromium.googlesource.com/chromium/src/+/21e19401af0b12d13ddc14d4a167f1b02ec65a6b * Update renamed header files * TODO: update with upstream changes This code needs to be updated to handle the changes made in: https://chromium.googlesource.com/chromium/src/+/19be6547a9a898104cd172de77184e243643ee19 * chore: bump chromium in DEPS to 82e5a2c6bd33c2e53634a09fbcbc9fcac1e7ff93 * chore: bump chromium in DEPS to 91f877cadd2995201c276e952b3bf2c60b226c64 * chore: bump chromium in DEPS to 43fcd2ab2677a06d38246b42761dc5b40cf87177 * chore: bump chromium in DEPS to e30957dcb710c0977a7ff95b8d3cf65843df12ca * chore: bump chromium in DEPS to 6a8335a56db12aae2fd06296f82579d804d92217 * chore: bump chromium in DEPS to a4a436cbc28ace88d71752f8f479e59559e54e46 * chore: bump chromium in DEPS to 982bbd0e4b2e1d57d515f384f6483ffc0d7073ad * chore: bump chromium in DEPS to 92bb7a99f84ffcdf41d4edca57e90b1f0c7c6c8b * update patches * add checkout_google_benchmark gclient var * FIXME: workaround grit bug * chore: bump chromium in DEPS to d3623fc53615739e6b59340a5d349e4b397cb7c5 * update patches * Remove color arg from DidChangeThemeColor(). https://chromium-review.googlesource.com/c/chromium/src/+/1982623 * update CreateFileURLLoader with new suffix CL: https://chromium-review.googlesource.com/c/chromium/src/+/1981414 * add node patch for removal of task API in v8 CL: https://chromium-review.googlesource.com/c/v8/v8/+/1868620 * add disable_secure_dns param for WillCreateURLLoaderFactory CL: https://chromium-review.googlesource.com/c/chromium/src/+/1888099 * switch to mojo-ified PrintMsg_PrintPreview CL: https://chromium-review.googlesource.com/c/chromium/src/+/1972307 * chore: bump chromium in DEPS to e7a6d173632660b6aeb9806e9132c34a315331c2 * update missing chrome/browser/ssl:proto dependency after chrome removal CL: https://chromium-review.googlesource.com/c/chromium/src/+/1986082 * chore: add libvulkan.so to the linux manifest CL: https://chromium-review.googlesource.com/c/chromium/src/+/1973042 * revert DidChangeThemeColor ternary change due to templates * match Chrome's mojo-ified implementation in geolocation_permission_context.cc CL: https://chromium-review.googlesource.com/c/chromium/src/+/1963371 * add vulkan-1.dll to zips https://github.com/KhronosGroup/Vulkan-Loader/commit/2d6f74c6d4319e94cf1fa33954c619ab4428f2b8 * add bug link to fixme_grit_conflicts.patch * Introduce device.mojom.DeviceService https://chromium-review.googlesource.com/c/chromium/src/+/1956277 * PDF Compositor rename to Print Compositor https://chromium-review.googlesource.com/c/chromium/src/+/1981135 * chore: bump chromium_version 00362ea584735b4acf4c5a0e1912d7987f8645ab * chore: update patches * Use a virtual base class to provide GetWidget(). https://chromium-review.googlesource.com/c/chromium/src/+/1996948 * [base] Remove usage of base::CurrentThread https://chromium-review.googlesource.com/c/chromium/src/+/1962019 * chore: gn format * Revert "ci: Use Visual Studio Build Tools instead of VS Studio (#21771)" This reverts commit 9c1310dadc09f88daf8866b38af9ebb385a2e9d3. * fix: trigger resize when iframe requests fullscreen * fix: Locking scheme registry is not necessary https://chromium-review.googlesource.com/c/chromium/src/+/1973198 * chore: bump chromium f707f1d6d428f84cf14b64bc2ca74372e25c6ce7 * chore: update patches * ui/base/clipboard: Remove redundant ANSI format functions https://chromium-review.googlesource.com/c/chromium/src/+/1992015 * [base] Prepare //chrome for Value::GetList() switch https://chromium-review.googlesource.com/c/chromium/src/+/1962255 Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: loc <andy@slack-corp.com> Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net> Co-authored-by: Robo <hop2deep@gmail.com>
2020-01-17 18:41:52 +00:00
const views::Widget* NativeWindow::GetWidgetImpl() const {
return widget();
}
base::string16 NativeWindow::GetAccessibleWindowTitle() const {
if (accessible_title_.empty()) {
return views::WidgetDelegate::GetAccessibleWindowTitle();
}
return accessible_title_;
}
void NativeWindow::SetAccessibleTitle(const std::string& title) {
accessible_title_ = base::UTF8ToUTF16(title);
}
std::string NativeWindow::GetAccessibleTitle() {
return base::UTF16ToUTF8(accessible_title_);
}
// static
void NativeWindowRelay::CreateForWebContents(
content::WebContents* web_contents,
base::WeakPtr<NativeWindow> window) {
DCHECK(web_contents);
if (!web_contents->GetUserData(UserDataKey())) {
web_contents->SetUserData(UserDataKey(),
base::WrapUnique(new NativeWindowRelay(window)));
}
}
NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
: native_window_(window) {}
NativeWindowRelay::~NativeWindowRelay() = default;
WEB_CONTENTS_USER_DATA_KEY_IMPL(NativeWindowRelay)
} // namespace electron