mac: Avoid managing NSWindow by hand.
This commit is contained in:
parent
2ab5d6e35a
commit
84d458687a
2 changed files with 5 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#include "base/mac/scoped_nsobject.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ class NativeWindowMac : public NativeWindow {
|
||||||
void UpdateDraggableRegionsForCustomDrag(
|
void UpdateDraggableRegionsForCustomDrag(
|
||||||
const std::vector<DraggableRegion>& regions);
|
const std::vector<DraggableRegion>& regions);
|
||||||
|
|
||||||
NSWindow* window_;
|
base::scoped_nsobject<NSWindow> window_;
|
||||||
|
|
||||||
bool is_kiosk_;
|
bool is_kiosk_;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "base/mac/scoped_nsobject.h"
|
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#import "atom/browser/ui/cocoa/event_processing_window.h"
|
#import "atom/browser/ui/cocoa/event_processing_window.h"
|
||||||
|
@ -170,7 +169,7 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
|
||||||
defer:YES];
|
defer:YES];
|
||||||
|
|
||||||
[atomWindow setShell:this];
|
[atomWindow setShell:this];
|
||||||
window_ = atomWindow;
|
window_.reset(atomWindow);
|
||||||
|
|
||||||
AtomNSWindowDelegate* delegate =
|
AtomNSWindowDelegate* delegate =
|
||||||
[[AtomNSWindowDelegate alloc] initWithShell:this];
|
[[AtomNSWindowDelegate alloc] initWithShell:this];
|
||||||
|
@ -203,9 +202,6 @@ NativeWindowMac::~NativeWindowMac() {
|
||||||
// Force InspectableWebContents to be destroyed before we destroy window,
|
// Force InspectableWebContents to be destroyed before we destroy window,
|
||||||
// because it may still be observing the window at this time.
|
// because it may still be observing the window at this time.
|
||||||
inspectable_web_contents_.reset();
|
inspectable_web_contents_.reset();
|
||||||
|
|
||||||
if (window_)
|
|
||||||
[window_ release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::Close() {
|
void NativeWindowMac::Close() {
|
||||||
|
@ -332,10 +328,10 @@ gfx::Size NativeWindowMac::GetMaximumSize() {
|
||||||
void NativeWindowMac::SetResizable(bool resizable) {
|
void NativeWindowMac::SetResizable(bool resizable) {
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:YES];
|
||||||
[window_ setStyleMask:window_.styleMask | NSResizableWindowMask];
|
[window_ setStyleMask:[window_ styleMask] | NSResizableWindowMask];
|
||||||
} else {
|
} else {
|
||||||
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
[[window_ standardWindowButton:NSWindowZoomButton] setEnabled:NO];
|
||||||
[window_ setStyleMask:window_.styleMask ^ NSResizableWindowMask];
|
[window_ setStyleMask:[window_ styleMask] ^ NSResizableWindowMask];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue