Browse Source

give window a default content view

Certain APIs are expecting the window to have a content view, having a
default one simplifies our design.
Cheng Zhao 7 years ago
parent
commit
2f3fcb9dbe
2 changed files with 6 additions and 0 deletions
  1. 3 0
      atom/browser/native_window_mac.mm
  2. 3 0
      atom/browser/native_window_views.cc

+ 3 - 0
atom/browser/native_window_mac.mm

@@ -451,6 +451,9 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
   // by calls to other APIs.
   SetMaximizable(maximizable);
 
+  // Default content view.
+  SetContentView(new views::View());
+
   // Make sure the bottom corner is rounded for non-modal windows:
   // http://crbug.com/396264. But do not enable it on OS X 10.9 for transparent
   // window, otherwise a semi-transparent frame would show.

+ 3 - 0
atom/browser/native_window_views.cc

@@ -276,6 +276,9 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
 #endif
   }
 
+  // Default content view.
+  SetContentView(new views::View());
+
   gfx::Size size = bounds.size();
   if (has_frame() &&
       options.Get(options::kUseContentSize, &use_content_size_) &&