#include "base/memory/scoped_ptr.h"
#include "atom/browser/native_window.h"
+@class AtomNSWindow;
+@class AtomNSWindowDelegate;
@class FullSizeContentView;
class SkRegion;
// whehter we can drag.
void InstallDraggableRegionView();
- base::scoped_nsobject<NSWindow> window_;
+ base::scoped_nsobject<AtomNSWindow> window_;
+ base::scoped_nsobject<AtomNSWindowDelegate> window_delegate_;
// The view that will fill the whole frameless window.
base::scoped_nsobject<FullSizeContentView> content_view_;
- (void)windowWillClose:(NSNotification*)notification {
shell_->NotifyWindowClosed();
- [self autorelease];
}
- (BOOL)windowShouldClose:(id)window {
width,
height);
- AtomNSWindow* atomWindow = [[AtomNSWindow alloc]
+ window_.reset([[AtomNSWindow alloc]
initWithContentRect:cocoa_bounds
styleMask:NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSResizableWindowMask |
NSTexturedBackgroundWindowMask
backing:NSBackingStoreBuffered
- defer:YES];
+ defer:YES]);
+ [window_ setShell:this];
+ [window_ setEnableLargerThanScreen:enable_larger_than_screen_];
- [atomWindow setShell:this];
- [atomWindow setEnableLargerThanScreen:enable_larger_than_screen_];
- window_.reset(atomWindow);
-
- AtomNSWindowDelegate* delegate =
- [[AtomNSWindowDelegate alloc] initWithShell:this];
- [window_ setDelegate:delegate];
+ window_delegate_.reset([[AtomNSWindowDelegate alloc] initWithShell:this]);
+ [window_ setDelegate:window_delegate_];
if (transparent_) {
// Make window has transparent background.
// Enable the NSView to accept first mouse event.
bool acceptsFirstMouse = false;
options.Get(switches::kAcceptFirstMouse, &acceptsFirstMouse);
- [delegate setAcceptsFirstMouse:acceptsFirstMouse];
+ [window_delegate_ setAcceptsFirstMouse:acceptsFirstMouse];
// Disable fullscreen button when 'fullscreen' is specified to false.
bool fullscreen;
event.type == content::NativeWebKeyboardEvent::Char)
return;
- if (event.os_event.window == window_) {
+ if (event.os_event.window == window_.get()) {
EventProcessingWindow* event_window =
static_cast<EventProcessingWindow*>(window_);
DCHECK([event_window isKindOfClass:[EventProcessingWindow class]]);