native_window.cc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "shell/browser/native_window.h"
  5. #include <algorithm>
  6. #include <string>
  7. #include <utility>
  8. #include <vector>
  9. #include "base/memory/ptr_util.h"
  10. #include "base/strings/utf_string_conversions.h"
  11. #include "shell/browser/browser.h"
  12. #include "shell/browser/window_list.h"
  13. #include "shell/common/color_util.h"
  14. #include "shell/common/gin_helper/dictionary.h"
  15. #include "shell/common/gin_helper/persistent_dictionary.h"
  16. #include "shell/common/options_switches.h"
  17. #include "ui/views/widget/widget.h"
  18. #if defined(OS_WIN)
  19. #include "ui/base/win/shell.h"
  20. #include "ui/display/win/screen_win.h"
  21. #endif
  22. namespace electron {
  23. namespace {
  24. #if defined(OS_WIN)
  25. gfx::Size GetExpandedWindowSize(const NativeWindow* window, gfx::Size size) {
  26. if (!window->transparent() || !ui::win::IsAeroGlassEnabled())
  27. return size;
  28. gfx::Size min_size = display::win::ScreenWin::ScreenToDIPSize(
  29. window->GetAcceleratedWidget(), gfx::Size(64, 64));
  30. // Some AMD drivers can't display windows that are less than 64x64 pixels,
  31. // so expand them to be at least that size. http://crbug.com/286609
  32. gfx::Size expanded(std::max(size.width(), min_size.width()),
  33. std::max(size.height(), min_size.height()));
  34. return expanded;
  35. }
  36. #endif
  37. } // namespace
  38. NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
  39. NativeWindow* parent)
  40. : widget_(new views::Widget), parent_(parent), weak_factory_(this) {
  41. ++next_id_;
  42. options.Get(options::kFrame, &has_frame_);
  43. options.Get(options::kTransparent, &transparent_);
  44. options.Get(options::kEnableLargerThanScreen, &enable_larger_than_screen_);
  45. if (parent)
  46. options.Get("modal", &is_modal_);
  47. WindowList::AddWindow(this);
  48. }
  49. NativeWindow::~NativeWindow() {
  50. // It's possible that the windows gets destroyed before it's closed, in that
  51. // case we need to ensure the Widget delegate gets destroyed and
  52. // OnWindowClosed message is still notified.
  53. if (widget_->widget_delegate())
  54. widget_->OnNativeWidgetDestroyed();
  55. NotifyWindowClosed();
  56. }
  57. void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) {
  58. // Setup window from options.
  59. int x = -1, y = -1;
  60. bool center;
  61. if (options.Get(options::kX, &x) && options.Get(options::kY, &y)) {
  62. SetPosition(gfx::Point(x, y));
  63. #if defined(OS_WIN)
  64. // FIXME(felixrieseberg): Dirty, dirty workaround for
  65. // https://github.com/electron/electron/issues/10862
  66. // Somehow, we need to call `SetBounds` twice to get
  67. // usable results. The root cause is still unknown.
  68. SetPosition(gfx::Point(x, y));
  69. #endif
  70. } else if (options.Get(options::kCenter, &center) && center) {
  71. Center();
  72. }
  73. bool use_content_size = false;
  74. options.Get(options::kUseContentSize, &use_content_size);
  75. // On Linux and Window we may already have maximum size defined.
  76. extensions::SizeConstraints size_constraints(
  77. use_content_size ? GetContentSizeConstraints() : GetSizeConstraints());
  78. int min_height = 0, min_width = 0;
  79. if (options.Get(options::kMinHeight, &min_height) |
  80. options.Get(options::kMinWidth, &min_width)) {
  81. size_constraints.set_minimum_size(gfx::Size(min_width, min_height));
  82. }
  83. int max_height = INT_MAX, max_width = INT_MAX;
  84. if (options.Get(options::kMaxHeight, &max_height) |
  85. options.Get(options::kMaxWidth, &max_width)) {
  86. size_constraints.set_maximum_size(gfx::Size(max_width, max_height));
  87. }
  88. if (use_content_size) {
  89. SetContentSizeConstraints(size_constraints);
  90. } else {
  91. SetSizeConstraints(size_constraints);
  92. }
  93. #if defined(OS_WIN) || defined(OS_LINUX)
  94. bool resizable;
  95. if (options.Get(options::kResizable, &resizable)) {
  96. SetResizable(resizable);
  97. }
  98. bool closable;
  99. if (options.Get(options::kClosable, &closable)) {
  100. SetClosable(closable);
  101. }
  102. #endif
  103. bool movable;
  104. if (options.Get(options::kMovable, &movable)) {
  105. SetMovable(movable);
  106. }
  107. bool has_shadow;
  108. if (options.Get(options::kHasShadow, &has_shadow)) {
  109. SetHasShadow(has_shadow);
  110. }
  111. double opacity;
  112. if (options.Get(options::kOpacity, &opacity)) {
  113. SetOpacity(opacity);
  114. }
  115. bool top;
  116. if (options.Get(options::kAlwaysOnTop, &top) && top) {
  117. SetAlwaysOnTop(ui::ZOrderLevel::kFloatingWindow);
  118. }
  119. bool fullscreenable = true;
  120. bool fullscreen = false;
  121. if (options.Get(options::kFullscreen, &fullscreen) && !fullscreen) {
  122. // Disable fullscreen button if 'fullscreen' is specified to false.
  123. #if defined(OS_MAC)
  124. fullscreenable = false;
  125. #endif
  126. }
  127. // Overridden by 'fullscreenable'.
  128. options.Get(options::kFullScreenable, &fullscreenable);
  129. SetFullScreenable(fullscreenable);
  130. if (fullscreen) {
  131. SetFullScreen(true);
  132. }
  133. bool skip;
  134. if (options.Get(options::kSkipTaskbar, &skip)) {
  135. SetSkipTaskbar(skip);
  136. }
  137. bool kiosk;
  138. if (options.Get(options::kKiosk, &kiosk) && kiosk) {
  139. SetKiosk(kiosk);
  140. }
  141. #if defined(OS_MAC)
  142. std::string type;
  143. if (options.Get(options::kVibrancyType, &type)) {
  144. SetVibrancy(type);
  145. }
  146. #endif
  147. std::string color;
  148. if (options.Get(options::kBackgroundColor, &color)) {
  149. SetBackgroundColor(ParseHexColor(color));
  150. } else if (!transparent()) {
  151. // For normal window, use white as default background.
  152. SetBackgroundColor(SK_ColorWHITE);
  153. }
  154. std::string title(Browser::Get()->GetName());
  155. options.Get(options::kTitle, &title);
  156. SetTitle(title);
  157. // Then show it.
  158. bool show = true;
  159. options.Get(options::kShow, &show);
  160. if (show)
  161. Show();
  162. }
  163. bool NativeWindow::IsClosed() const {
  164. return is_closed_;
  165. }
  166. void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
  167. SetBounds(gfx::Rect(GetPosition(), size), animate);
  168. }
  169. gfx::Size NativeWindow::GetSize() {
  170. return GetBounds().size();
  171. }
  172. void NativeWindow::SetPosition(const gfx::Point& position, bool animate) {
  173. SetBounds(gfx::Rect(position, GetSize()), animate);
  174. }
  175. gfx::Point NativeWindow::GetPosition() {
  176. return GetBounds().origin();
  177. }
  178. void NativeWindow::SetContentSize(const gfx::Size& size, bool animate) {
  179. SetSize(ContentBoundsToWindowBounds(gfx::Rect(size)).size(), animate);
  180. }
  181. gfx::Size NativeWindow::GetContentSize() {
  182. return GetContentBounds().size();
  183. }
  184. void NativeWindow::SetContentBounds(const gfx::Rect& bounds, bool animate) {
  185. SetBounds(ContentBoundsToWindowBounds(bounds), animate);
  186. }
  187. gfx::Rect NativeWindow::GetContentBounds() {
  188. return WindowBoundsToContentBounds(GetBounds());
  189. }
  190. bool NativeWindow::IsNormal() {
  191. return !IsMinimized() && !IsMaximized() && !IsFullscreen();
  192. }
  193. void NativeWindow::SetSizeConstraints(
  194. const extensions::SizeConstraints& window_constraints) {
  195. extensions::SizeConstraints content_constraints(GetContentSizeConstraints());
  196. if (window_constraints.HasMaximumSize()) {
  197. gfx::Rect max_bounds = WindowBoundsToContentBounds(
  198. gfx::Rect(window_constraints.GetMaximumSize()));
  199. content_constraints.set_maximum_size(max_bounds.size());
  200. }
  201. if (window_constraints.HasMinimumSize()) {
  202. gfx::Rect min_bounds = WindowBoundsToContentBounds(
  203. gfx::Rect(window_constraints.GetMinimumSize()));
  204. content_constraints.set_minimum_size(min_bounds.size());
  205. }
  206. SetContentSizeConstraints(content_constraints);
  207. }
  208. extensions::SizeConstraints NativeWindow::GetSizeConstraints() const {
  209. extensions::SizeConstraints content_constraints = GetContentSizeConstraints();
  210. extensions::SizeConstraints window_constraints;
  211. if (content_constraints.HasMaximumSize()) {
  212. gfx::Rect max_bounds = ContentBoundsToWindowBounds(
  213. gfx::Rect(content_constraints.GetMaximumSize()));
  214. window_constraints.set_maximum_size(max_bounds.size());
  215. }
  216. if (content_constraints.HasMinimumSize()) {
  217. gfx::Rect min_bounds = ContentBoundsToWindowBounds(
  218. gfx::Rect(content_constraints.GetMinimumSize()));
  219. window_constraints.set_minimum_size(min_bounds.size());
  220. }
  221. return window_constraints;
  222. }
  223. void NativeWindow::SetContentSizeConstraints(
  224. const extensions::SizeConstraints& size_constraints) {
  225. size_constraints_ = size_constraints;
  226. }
  227. extensions::SizeConstraints NativeWindow::GetContentSizeConstraints() const {
  228. return size_constraints_;
  229. }
  230. void NativeWindow::SetMinimumSize(const gfx::Size& size) {
  231. extensions::SizeConstraints size_constraints;
  232. size_constraints.set_minimum_size(size);
  233. SetSizeConstraints(size_constraints);
  234. }
  235. gfx::Size NativeWindow::GetMinimumSize() const {
  236. return GetSizeConstraints().GetMinimumSize();
  237. }
  238. void NativeWindow::SetMaximumSize(const gfx::Size& size) {
  239. extensions::SizeConstraints size_constraints;
  240. size_constraints.set_maximum_size(size);
  241. SetSizeConstraints(size_constraints);
  242. }
  243. gfx::Size NativeWindow::GetMaximumSize() const {
  244. return GetSizeConstraints().GetMaximumSize();
  245. }
  246. gfx::Size NativeWindow::GetContentMinimumSize() const {
  247. return GetContentSizeConstraints().GetMinimumSize();
  248. }
  249. gfx::Size NativeWindow::GetContentMaximumSize() const {
  250. gfx::Size maximum_size = GetContentSizeConstraints().GetMaximumSize();
  251. #if defined(OS_WIN)
  252. return GetContentSizeConstraints().HasMaximumSize()
  253. ? GetExpandedWindowSize(this, maximum_size)
  254. : maximum_size;
  255. #else
  256. return maximum_size;
  257. #endif
  258. }
  259. void NativeWindow::SetSheetOffset(const double offsetX, const double offsetY) {
  260. sheet_offset_x_ = offsetX;
  261. sheet_offset_y_ = offsetY;
  262. }
  263. double NativeWindow::GetSheetOffsetX() {
  264. return sheet_offset_x_;
  265. }
  266. double NativeWindow::GetSheetOffsetY() {
  267. return sheet_offset_y_;
  268. }
  269. bool NativeWindow::IsTabletMode() const {
  270. return false;
  271. }
  272. void NativeWindow::SetRepresentedFilename(const std::string& filename) {}
  273. std::string NativeWindow::GetRepresentedFilename() {
  274. return "";
  275. }
  276. void NativeWindow::SetDocumentEdited(bool edited) {}
  277. bool NativeWindow::IsDocumentEdited() {
  278. return false;
  279. }
  280. void NativeWindow::SetFocusable(bool focusable) {}
  281. void NativeWindow::SetMenu(ElectronMenuModel* menu) {}
  282. void NativeWindow::SetParentWindow(NativeWindow* parent) {
  283. parent_ = parent;
  284. }
  285. void NativeWindow::SetAutoHideCursor(bool auto_hide) {}
  286. void NativeWindow::SelectPreviousTab() {}
  287. void NativeWindow::SelectNextTab() {}
  288. void NativeWindow::MergeAllWindows() {}
  289. void NativeWindow::MoveTabToNewWindow() {}
  290. void NativeWindow::ToggleTabBar() {}
  291. bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
  292. return true; // for non-Mac platforms
  293. }
  294. void NativeWindow::SetVibrancy(const std::string& type) {}
  295. void NativeWindow::SetTouchBar(
  296. std::vector<gin_helper::PersistentDictionary> items) {}
  297. void NativeWindow::RefreshTouchBarItem(const std::string& item_id) {}
  298. void NativeWindow::SetEscapeTouchBarItem(
  299. gin_helper::PersistentDictionary item) {}
  300. void NativeWindow::SetAutoHideMenuBar(bool auto_hide) {}
  301. bool NativeWindow::IsMenuBarAutoHide() {
  302. return false;
  303. }
  304. void NativeWindow::SetMenuBarVisibility(bool visible) {}
  305. bool NativeWindow::IsMenuBarVisible() {
  306. return true;
  307. }
  308. bool NativeWindow::SetWindowButtonVisibility(bool visible) {
  309. return false;
  310. }
  311. double NativeWindow::GetAspectRatio() {
  312. return aspect_ratio_;
  313. }
  314. gfx::Size NativeWindow::GetAspectRatioExtraSize() {
  315. return aspect_ratio_extraSize_;
  316. }
  317. void NativeWindow::SetAspectRatio(double aspect_ratio,
  318. const gfx::Size& extra_size) {
  319. aspect_ratio_ = aspect_ratio;
  320. aspect_ratio_extraSize_ = extra_size;
  321. }
  322. void NativeWindow::PreviewFile(const std::string& path,
  323. const std::string& display_name) {}
  324. void NativeWindow::CloseFilePreview() {}
  325. void NativeWindow::NotifyWindowRequestPreferredWith(int* width) {
  326. for (NativeWindowObserver& observer : observers_)
  327. observer.RequestPreferredWidth(width);
  328. }
  329. void NativeWindow::NotifyWindowCloseButtonClicked() {
  330. // First ask the observers whether we want to close.
  331. bool prevent_default = false;
  332. for (NativeWindowObserver& observer : observers_)
  333. observer.WillCloseWindow(&prevent_default);
  334. if (prevent_default) {
  335. WindowList::WindowCloseCancelled(this);
  336. return;
  337. }
  338. // Then ask the observers how should we close the window.
  339. for (NativeWindowObserver& observer : observers_)
  340. observer.OnCloseButtonClicked(&prevent_default);
  341. if (prevent_default)
  342. return;
  343. CloseImmediately();
  344. }
  345. void NativeWindow::NotifyWindowClosed() {
  346. if (is_closed_)
  347. return;
  348. is_closed_ = true;
  349. for (NativeWindowObserver& observer : observers_)
  350. observer.OnWindowClosed();
  351. WindowList::RemoveWindow(this);
  352. }
  353. void NativeWindow::NotifyWindowEndSession() {
  354. for (NativeWindowObserver& observer : observers_)
  355. observer.OnWindowEndSession();
  356. }
  357. void NativeWindow::NotifyWindowBlur() {
  358. for (NativeWindowObserver& observer : observers_)
  359. observer.OnWindowBlur();
  360. }
  361. void NativeWindow::NotifyWindowFocus() {
  362. for (NativeWindowObserver& observer : observers_)
  363. observer.OnWindowFocus();
  364. }
  365. void NativeWindow::NotifyWindowIsKeyChanged(bool is_key) {
  366. for (NativeWindowObserver& observer : observers_)
  367. observer.OnWindowIsKeyChanged(is_key);
  368. }
  369. void NativeWindow::NotifyWindowShow() {
  370. for (NativeWindowObserver& observer : observers_)
  371. observer.OnWindowShow();
  372. }
  373. void NativeWindow::NotifyWindowHide() {
  374. for (NativeWindowObserver& observer : observers_)
  375. observer.OnWindowHide();
  376. }
  377. void NativeWindow::NotifyWindowMaximize() {
  378. for (NativeWindowObserver& observer : observers_)
  379. observer.OnWindowMaximize();
  380. }
  381. void NativeWindow::NotifyWindowUnmaximize() {
  382. for (NativeWindowObserver& observer : observers_)
  383. observer.OnWindowUnmaximize();
  384. }
  385. void NativeWindow::NotifyWindowMinimize() {
  386. for (NativeWindowObserver& observer : observers_)
  387. observer.OnWindowMinimize();
  388. }
  389. void NativeWindow::NotifyWindowRestore() {
  390. for (NativeWindowObserver& observer : observers_)
  391. observer.OnWindowRestore();
  392. }
  393. void NativeWindow::NotifyWindowWillResize(const gfx::Rect& new_bounds,
  394. bool* prevent_default) {
  395. for (NativeWindowObserver& observer : observers_)
  396. observer.OnWindowWillResize(new_bounds, prevent_default);
  397. }
  398. void NativeWindow::NotifyWindowWillMove(const gfx::Rect& new_bounds,
  399. bool* prevent_default) {
  400. for (NativeWindowObserver& observer : observers_)
  401. observer.OnWindowWillMove(new_bounds, prevent_default);
  402. }
  403. void NativeWindow::NotifyWindowResize() {
  404. for (NativeWindowObserver& observer : observers_)
  405. observer.OnWindowResize();
  406. }
  407. void NativeWindow::NotifyWindowResized() {
  408. for (NativeWindowObserver& observer : observers_)
  409. observer.OnWindowResized();
  410. }
  411. void NativeWindow::NotifyWindowMove() {
  412. for (NativeWindowObserver& observer : observers_)
  413. observer.OnWindowMove();
  414. }
  415. void NativeWindow::NotifyWindowMoved() {
  416. for (NativeWindowObserver& observer : observers_)
  417. observer.OnWindowMoved();
  418. }
  419. void NativeWindow::NotifyWindowEnterFullScreen() {
  420. for (NativeWindowObserver& observer : observers_)
  421. observer.OnWindowEnterFullScreen();
  422. }
  423. void NativeWindow::NotifyWindowScrollTouchBegin() {
  424. for (NativeWindowObserver& observer : observers_)
  425. observer.OnWindowScrollTouchBegin();
  426. }
  427. void NativeWindow::NotifyWindowScrollTouchEnd() {
  428. for (NativeWindowObserver& observer : observers_)
  429. observer.OnWindowScrollTouchEnd();
  430. }
  431. void NativeWindow::NotifyWindowSwipe(const std::string& direction) {
  432. for (NativeWindowObserver& observer : observers_)
  433. observer.OnWindowSwipe(direction);
  434. }
  435. void NativeWindow::NotifyWindowRotateGesture(float rotation) {
  436. for (NativeWindowObserver& observer : observers_)
  437. observer.OnWindowRotateGesture(rotation);
  438. }
  439. void NativeWindow::NotifyWindowSheetBegin() {
  440. for (NativeWindowObserver& observer : observers_)
  441. observer.OnWindowSheetBegin();
  442. }
  443. void NativeWindow::NotifyWindowSheetEnd() {
  444. for (NativeWindowObserver& observer : observers_)
  445. observer.OnWindowSheetEnd();
  446. }
  447. void NativeWindow::NotifyWindowLeaveFullScreen() {
  448. for (NativeWindowObserver& observer : observers_)
  449. observer.OnWindowLeaveFullScreen();
  450. }
  451. void NativeWindow::NotifyWindowEnterHtmlFullScreen() {
  452. for (NativeWindowObserver& observer : observers_)
  453. observer.OnWindowEnterHtmlFullScreen();
  454. }
  455. void NativeWindow::NotifyWindowLeaveHtmlFullScreen() {
  456. for (NativeWindowObserver& observer : observers_)
  457. observer.OnWindowLeaveHtmlFullScreen();
  458. }
  459. void NativeWindow::NotifyWindowAlwaysOnTopChanged() {
  460. for (NativeWindowObserver& observer : observers_)
  461. observer.OnWindowAlwaysOnTopChanged();
  462. }
  463. void NativeWindow::NotifyWindowExecuteAppCommand(const std::string& command) {
  464. for (NativeWindowObserver& observer : observers_)
  465. observer.OnExecuteAppCommand(command);
  466. }
  467. void NativeWindow::NotifyTouchBarItemInteraction(
  468. const std::string& item_id,
  469. const base::DictionaryValue& details) {
  470. for (NativeWindowObserver& observer : observers_)
  471. observer.OnTouchBarItemResult(item_id, details);
  472. }
  473. void NativeWindow::NotifyNewWindowForTab() {
  474. for (NativeWindowObserver& observer : observers_)
  475. observer.OnNewWindowForTab();
  476. }
  477. void NativeWindow::NotifyWindowSystemContextMenu(int x,
  478. int y,
  479. bool* prevent_default) {
  480. for (NativeWindowObserver& observer : observers_)
  481. observer.OnSystemContextMenu(x, y, prevent_default);
  482. }
  483. #if defined(OS_WIN)
  484. void NativeWindow::NotifyWindowMessage(UINT message,
  485. WPARAM w_param,
  486. LPARAM l_param) {
  487. for (NativeWindowObserver& observer : observers_)
  488. observer.OnWindowMessage(message, w_param, l_param);
  489. }
  490. #endif
  491. views::Widget* NativeWindow::GetWidget() {
  492. return widget();
  493. }
  494. const views::Widget* NativeWindow::GetWidget() const {
  495. return widget();
  496. }
  497. base::string16 NativeWindow::GetAccessibleWindowTitle() const {
  498. if (accessible_title_.empty()) {
  499. return views::WidgetDelegate::GetAccessibleWindowTitle();
  500. }
  501. return accessible_title_;
  502. }
  503. void NativeWindow::SetAccessibleTitle(const std::string& title) {
  504. accessible_title_ = base::UTF8ToUTF16(title);
  505. }
  506. std::string NativeWindow::GetAccessibleTitle() {
  507. return base::UTF16ToUTF8(accessible_title_);
  508. }
  509. // static
  510. int32_t NativeWindow::next_id_ = 0;
  511. // static
  512. void NativeWindowRelay::CreateForWebContents(
  513. content::WebContents* web_contents,
  514. base::WeakPtr<NativeWindow> window) {
  515. DCHECK(web_contents);
  516. if (!web_contents->GetUserData(UserDataKey())) {
  517. web_contents->SetUserData(UserDataKey(),
  518. base::WrapUnique(new NativeWindowRelay(window)));
  519. }
  520. }
  521. NativeWindowRelay::NativeWindowRelay(base::WeakPtr<NativeWindow> window)
  522. : native_window_(window) {}
  523. NativeWindowRelay::~NativeWindowRelay() = default;
  524. WEB_CONTENTS_USER_DATA_KEY_IMPL(NativeWindowRelay)
  525. } // namespace electron