From 9bc79f840e0d960b3fa487531da1793f74310ef4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 19 Apr 2018 15:36:14 +0900 Subject: [PATCH] mac: Override NativeWidgetMac --- .../browser/ui/cocoa/atom_native_widget_mac.h | 28 +++++++++++++++++++ .../ui/cocoa/atom_native_widget_mac.mm | 22 +++++++++++++++ filenames.gypi | 2 ++ 3 files changed, 52 insertions(+) create mode 100644 atom/browser/ui/cocoa/atom_native_widget_mac.h create mode 100644 atom/browser/ui/cocoa/atom_native_widget_mac.mm diff --git a/atom/browser/ui/cocoa/atom_native_widget_mac.h b/atom/browser/ui/cocoa/atom_native_widget_mac.h new file mode 100644 index 000000000000..a078fcb1ee02 --- /dev/null +++ b/atom/browser/ui/cocoa/atom_native_widget_mac.h @@ -0,0 +1,28 @@ +// Copyright (c) 2018 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_ +#define ATOM_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_ + +#include "ui/views/widget/native_widget_mac.h" + +namespace atom { + +class AtomNativeWidgetMac : public views::NativeWidgetMac { + public: + explicit AtomNativeWidgetMac(views::internal::NativeWidgetDelegate* delegate); + ~AtomNativeWidgetMac() override; + + protected: + // NativeWidgetMac: + views::NativeWidgetMacNSWindow* CreateNSWindow( + const views::Widget::InitParams& params) override; + + private: + DISALLOW_COPY_AND_ASSIGN(AtomNativeWidgetMac); +}; + +} // namespace atom + +#endif // ATOM_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_ diff --git a/atom/browser/ui/cocoa/atom_native_widget_mac.mm b/atom/browser/ui/cocoa/atom_native_widget_mac.mm new file mode 100644 index 000000000000..01f2fa392674 --- /dev/null +++ b/atom/browser/ui/cocoa/atom_native_widget_mac.mm @@ -0,0 +1,22 @@ +// Copyright (c) 2018 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/ui/cocoa/atom_native_widget_mac.h" + +namespace atom { + +AtomNativeWidgetMac::AtomNativeWidgetMac( + views::internal::NativeWidgetDelegate* delegate) + : views::NativeWidgetMac(delegate) { +} + +AtomNativeWidgetMac::~AtomNativeWidgetMac() { +} + +views::NativeWidgetMacNSWindow* AtomNativeWidgetMac::CreateNSWindow( + const views::Widget::InitParams& params) { + return views::NativeWidgetMac::CreateNSWindow(params); +} + +} // namespace atom diff --git a/filenames.gypi b/filenames.gypi index d607717e2780..a76b5d08d1d6 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -316,6 +316,8 @@ 'atom/browser/ui/cocoa/atom_bundle_mover.mm', 'atom/browser/ui/cocoa/atom_menu_controller.h', 'atom/browser/ui/cocoa/atom_menu_controller.mm', + 'atom/browser/ui/cocoa/atom_native_widget_mac.h', + 'atom/browser/ui/cocoa/atom_native_widget_mac.mm', 'atom/browser/ui/cocoa/atom_touch_bar.h', 'atom/browser/ui/cocoa/atom_touch_bar.mm', 'atom/browser/ui/cocoa/views_delegate_mac.h',