diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index b123c09fd1b..981b150301c 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -65,6 +65,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, menu_bar_(NULL), web_view_(inspectable_web_contents()->GetView()->GetView()), keyboard_event_handler_(new views::UnhandledKeyboardEventHandler), + use_content_size_(false), resizable_(true) { options.Get(switches::kResizable, &resizable_); options.Get(switches::kTitle, &title_); @@ -102,10 +103,9 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, set_background(views::Background::CreateStandardPanelBackground()); AddChildView(web_view_); - bool use_content_size; if (has_frame_ && - options.Get(switches::kUseContentSize, &use_content_size) && - use_content_size) + options.Get(switches::kUseContentSize, &use_content_size_) && + use_content_size_) bounds = ContentBoundsToWindowBounds(bounds); window_->CenterWindow(bounds.size()); @@ -302,7 +302,9 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) { gfx::Size content_size = GetContentSize(); menu_bar_ = new MenuBar; AddChildViewAt(menu_bar_, 0); - SetContentSize(content_size); + + if (use_content_size_) + SetContentSize(content_size); } menu_bar_->SetMenu(menu_model); diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index c4cf6cb8094..d4db4934e4c 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -132,6 +132,7 @@ class NativeWindowViews : public NativeWindow, // Map from accelerator to menu item's command id. accelerator_util::AcceleratorTable accelerator_table_; + bool use_content_size_; bool resizable_; std::string title_; gfx::Size minimum_size_; diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index f9eb37d4d92..957ea271d09 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -103,12 +103,9 @@ describe 'browser-window module', -> assert.equal contentSize[1], 400 it 'make window created with window size when not used', -> - # No way to reliably set size when window has not been shown on Linux. - return if process.platform is 'linux' - - contentSize = w.getSize() - assert.equal contentSize[0], 400 - assert.equal contentSize[1], 400 + size = w.getSize() + assert.equal size[0], 400 + assert.equal size[1], 400 describe 'beforeunload handler', -> it 'returning true would not prevent close', (done) ->