Simply the closing model.

This commit is contained in:
Cheng Zhao 2013-05-01 16:12:00 +08:00
parent 9f1fe4d2c2
commit edd8410c24
4 changed files with 23 additions and 49 deletions

View file

@ -36,15 +36,16 @@
return self;
}
- (void)windowWillClose:(NSNotification *)notification {
[self autorelease];
}
- (BOOL)windowShouldClose:(id)window {
if (!shell_->CanClose()) {
shell_->RequestToDestroyWindow();
return NO;
}
[self release];
return YES;
// When user tries to close the window by clicking the close button, we do
// not close the window immediately, instead we try to close the web page
// fisrt, and when the web page is closed the window will also be closed.
shell_->CloseWebContents();
return NO;
}
@end
@ -121,6 +122,10 @@ void NativeWindowMac::Close() {
[window() performClose:nil];
}
void NativeWindowMac::CloseImmediately() {
[window() close];
}
void NativeWindowMac::Move(const gfx::Rect& pos) {
NSRect cocoa_bounds = NSMakeRect(pos.x(), 0,
pos.width(),