Browse Source

mac: Override NativeWidgetMac

Cheng Zhao 7 years ago
parent
commit
9bc79f840e

+ 28 - 0
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_

+ 22 - 0
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

+ 2 - 0
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',