views: Add menu should not change window size.
This commit is contained in:
parent
ffad6fe884
commit
1a79093378
3 changed files with 10 additions and 10 deletions
|
@ -65,6 +65,7 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
||||||
menu_bar_(NULL),
|
menu_bar_(NULL),
|
||||||
web_view_(inspectable_web_contents()->GetView()->GetView()),
|
web_view_(inspectable_web_contents()->GetView()->GetView()),
|
||||||
keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
|
keyboard_event_handler_(new views::UnhandledKeyboardEventHandler),
|
||||||
|
use_content_size_(false),
|
||||||
resizable_(true) {
|
resizable_(true) {
|
||||||
options.Get(switches::kResizable, &resizable_);
|
options.Get(switches::kResizable, &resizable_);
|
||||||
options.Get(switches::kTitle, &title_);
|
options.Get(switches::kTitle, &title_);
|
||||||
|
@ -102,10 +103,9 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents,
|
||||||
set_background(views::Background::CreateStandardPanelBackground());
|
set_background(views::Background::CreateStandardPanelBackground());
|
||||||
AddChildView(web_view_);
|
AddChildView(web_view_);
|
||||||
|
|
||||||
bool use_content_size;
|
|
||||||
if (has_frame_ &&
|
if (has_frame_ &&
|
||||||
options.Get(switches::kUseContentSize, &use_content_size) &&
|
options.Get(switches::kUseContentSize, &use_content_size_) &&
|
||||||
use_content_size)
|
use_content_size_)
|
||||||
bounds = ContentBoundsToWindowBounds(bounds);
|
bounds = ContentBoundsToWindowBounds(bounds);
|
||||||
|
|
||||||
window_->CenterWindow(bounds.size());
|
window_->CenterWindow(bounds.size());
|
||||||
|
@ -302,7 +302,9 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
|
||||||
gfx::Size content_size = GetContentSize();
|
gfx::Size content_size = GetContentSize();
|
||||||
menu_bar_ = new MenuBar;
|
menu_bar_ = new MenuBar;
|
||||||
AddChildViewAt(menu_bar_, 0);
|
AddChildViewAt(menu_bar_, 0);
|
||||||
SetContentSize(content_size);
|
|
||||||
|
if (use_content_size_)
|
||||||
|
SetContentSize(content_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_bar_->SetMenu(menu_model);
|
menu_bar_->SetMenu(menu_model);
|
||||||
|
|
|
@ -132,6 +132,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
// Map from accelerator to menu item's command id.
|
// Map from accelerator to menu item's command id.
|
||||||
accelerator_util::AcceleratorTable accelerator_table_;
|
accelerator_util::AcceleratorTable accelerator_table_;
|
||||||
|
|
||||||
|
bool use_content_size_;
|
||||||
bool resizable_;
|
bool resizable_;
|
||||||
std::string title_;
|
std::string title_;
|
||||||
gfx::Size minimum_size_;
|
gfx::Size minimum_size_;
|
||||||
|
|
|
@ -103,12 +103,9 @@ describe 'browser-window module', ->
|
||||||
assert.equal contentSize[1], 400
|
assert.equal contentSize[1], 400
|
||||||
|
|
||||||
it 'make window created with window size when not used', ->
|
it 'make window created with window size when not used', ->
|
||||||
# No way to reliably set size when window has not been shown on Linux.
|
size = w.getSize()
|
||||||
return if process.platform is 'linux'
|
assert.equal size[0], 400
|
||||||
|
assert.equal size[1], 400
|
||||||
contentSize = w.getSize()
|
|
||||||
assert.equal contentSize[0], 400
|
|
||||||
assert.equal contentSize[1], 400
|
|
||||||
|
|
||||||
describe 'beforeunload handler', ->
|
describe 'beforeunload handler', ->
|
||||||
it 'returning true would not prevent close', (done) ->
|
it 'returning true would not prevent close', (done) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue