This commit is contained in:
Cheng Zhao 2018-03-06 15:06:58 +09:00
Родитель 498f5d65fd
Коммит 5a4c2fb61d
3 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -57,8 +57,8 @@ NativeWindow::NativeWindow(
parent_(parent),
is_modal_(false),
is_osr_dummy_(false),
inspectable_web_contents_(inspectable_web_contents),
browser_view_(nullptr),
inspectable_web_contents_(inspectable_web_contents),
weak_factory_(this) {
options.Get(options::kFrame, &has_frame_);
options.Get(options::kTransparent, &transparent_);

Просмотреть файл

@ -140,7 +140,7 @@ class NativeWindowMac : public NativeWindow {
void InternalSetParentWindow(NativeWindow* parent, bool attach);
void ShowWindowButton(NSWindowButton button);
void InstallView();
void InstallView(NSView* view);
base::scoped_nsobject<AtomNSWindow> window_;
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;

Просмотреть файл

@ -976,7 +976,7 @@ NativeWindowMac::NativeWindowMac(
return event;
}];
InstallView();
InstallView(web_contents->GetView()->GetNativeView());
std::string type;
if (options.Get(options::kVibrancyType, &type)) {
@ -1764,14 +1764,13 @@ void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
[view.superview addSubview:view positioned:NSWindowAbove relativeTo:nil];
}
void NativeWindowMac::InstallView() {
void NativeWindowMac::InstallView(NSView* 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.
if (!(transparent() && base::mac::IsOS10_9()) && !is_modal())
[[window_ contentView] setWantsLayer:YES];
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
if (has_frame()) {
[view setFrame:[[window_ contentView] bounds]];
[[window_ contentView] addSubview:view];