mac: Respect use-content-size when creating window.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 15 May 2014 07:19:02 +0000 (15:19 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 15 May 2014 07:19:02 +0000 (15:19 +0800)
atom/browser/native_window_mac.mm

index 2b73fb8..fb1e995 100644 (file)
@@ -6,18 +6,18 @@
 
 #include <string>
 
-#include "base/mac/mac_util.h"
-#include "base/strings/sys_string_conversions.h"
-#include "base/values.h"
 #import "atom/browser/ui/cocoa/event_processing_window.h"
-#include "brightray/browser/inspectable_web_contents.h"
-#include "brightray/browser/inspectable_web_contents_view.h"
 #include "atom/common/draggable_region.h"
 #include "atom/common/options_switches.h"
+#include "base/mac/mac_util.h"
+#include "base/strings/sys_string_conversions.h"
+#include "base/values.h"
 #include "content/public/browser/native_web_keyboard_event.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_view.h"
 #include "content/public/browser/render_view_host.h"
+#include "vendor/brightray/browser/inspectable_web_contents.h"
+#include "vendor/brightray/browser/inspectable_web_contents_view.h"
 
 static const CGFloat kAtomWindowCornerRadius = 4.0;
 
@@ -179,6 +179,12 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
   // We will manage window's lifetime ourselves.
   [window_ setReleasedWhenClosed:NO];
 
+  // On OS X the initial window size doesn't include window frame.
+  bool use_content_size = false;
+  options->GetBoolean(switches::kUseContentSize, &use_content_size);
+  if (has_frame_ && !use_content_size)
+    SetSize(gfx::Size(width, height));
+
   // Enable the NSView to accept first mouse event.
   bool acceptsFirstMouse = false;
   options->GetBoolean(switches::kAcceptFirstMouse, &acceptsFirstMouse);