зеркало из https://github.com/electron/electron.git
mac: Pass the view to install
This commit is contained in:
Родитель
498f5d65fd
Коммит
5a4c2fb61d
|
@ -57,8 +57,8 @@ NativeWindow::NativeWindow(
|
||||||
parent_(parent),
|
parent_(parent),
|
||||||
is_modal_(false),
|
is_modal_(false),
|
||||||
is_osr_dummy_(false),
|
is_osr_dummy_(false),
|
||||||
inspectable_web_contents_(inspectable_web_contents),
|
|
||||||
browser_view_(nullptr),
|
browser_view_(nullptr),
|
||||||
|
inspectable_web_contents_(inspectable_web_contents),
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
options.Get(options::kFrame, &has_frame_);
|
options.Get(options::kFrame, &has_frame_);
|
||||||
options.Get(options::kTransparent, &transparent_);
|
options.Get(options::kTransparent, &transparent_);
|
||||||
|
|
|
@ -140,7 +140,7 @@ class NativeWindowMac : public NativeWindow {
|
||||||
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
||||||
void ShowWindowButton(NSWindowButton button);
|
void ShowWindowButton(NSWindowButton button);
|
||||||
|
|
||||||
void InstallView();
|
void InstallView(NSView* view);
|
||||||
|
|
||||||
base::scoped_nsobject<AtomNSWindow> window_;
|
base::scoped_nsobject<AtomNSWindow> window_;
|
||||||
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
|
base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
|
||||||
|
|
|
@ -976,7 +976,7 @@ NativeWindowMac::NativeWindowMac(
|
||||||
return event;
|
return event;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
InstallView();
|
InstallView(web_contents->GetView()->GetNativeView());
|
||||||
|
|
||||||
std::string type;
|
std::string type;
|
||||||
if (options.Get(options::kVibrancyType, &type)) {
|
if (options.Get(options::kVibrancyType, &type)) {
|
||||||
|
@ -1764,14 +1764,13 @@ void NativeWindowMac::ShowWindowButton(NSWindowButton button) {
|
||||||
[view.superview addSubview:view positioned:NSWindowAbove relativeTo:nil];
|
[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.
|
// 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
|
// But do not enable it on OS X 10.9 for transparent window, otherwise a
|
||||||
// semi-transparent frame would show.
|
// semi-transparent frame would show.
|
||||||
if (!(transparent() && base::mac::IsOS10_9()) && !is_modal())
|
if (!(transparent() && base::mac::IsOS10_9()) && !is_modal())
|
||||||
[[window_ contentView] setWantsLayer:YES];
|
[[window_ contentView] setWantsLayer:YES];
|
||||||
|
|
||||||
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
|
|
||||||
if (has_frame()) {
|
if (has_frame()) {
|
||||||
[view setFrame:[[window_ contentView] bounds]];
|
[view setFrame:[[window_ contentView] bounds]];
|
||||||
[[window_ contentView] addSubview:view];
|
[[window_ contentView] addSubview:view];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче