| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 7 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 8 | 9 |
| 9 @implementation FullscreenWindow | 10 @implementation FullscreenWindow |
| 10 | 11 |
| 11 // Make sure our designated initializer gets called. | 12 // Make sure our designated initializer gets called. |
| 12 - (id)init { | 13 - (id)init { |
| 13 return [self initForScreen:[NSScreen mainScreen]]; | 14 return [self initForScreen:[NSScreen mainScreen]]; |
| 14 } | 15 } |
| 15 | 16 |
| 16 - (id)initForScreen:(NSScreen*)screen { | 17 - (id)initForScreen:(NSScreen*)screen { |
| 17 NSRect contentRect; | 18 NSRect contentRect; |
| 18 contentRect.origin = NSZeroPoint; | 19 contentRect.origin = NSZeroPoint; |
| 19 contentRect.size = [screen frame].size; | 20 contentRect.size = [screen frame].size; |
| 20 | 21 |
| 21 if ((self = [super initWithContentRect:contentRect | 22 if ((self = [super initWithContentRect:contentRect |
| 22 styleMask:NSBorderlessWindowMask | 23 styleMask:NSBorderlessWindowMask |
| 23 backing:NSBackingStoreBuffered | 24 backing:NSBackingStoreBuffered |
| 24 defer:YES | 25 defer:YES |
| 25 screen:screen])) { | 26 screen:screen])) { |
| 26 [self setReleasedWhenClosed:NO]; | 27 [self setReleasedWhenClosed:NO]; |
| 27 // Borderless windows don't usually show up in the Windows menu so whine at | 28 // Borderless windows don't usually show up in the Windows menu so whine at |
| 28 // Cocoa until it complies. See -dealloc and -setTitle: as well. | 29 // Cocoa until it complies. See -dealloc and -setTitle: as well. |
| 29 [NSApp addWindowsItem:self title:@"" filename:NO]; | 30 [NSApp addWindowsItem:self title:@"" filename:NO]; |
| 31 [[self contentView] cr_setWantsLayer:YES]; |
| 30 } | 32 } |
| 31 return self; | 33 return self; |
| 32 } | 34 } |
| 33 | 35 |
| 34 - (void)dealloc { | 36 - (void)dealloc { |
| 35 // Paranoia; doesn't seem to be necessary but it doesn't hurt. | 37 // Paranoia; doesn't seem to be necessary but it doesn't hurt. |
| 36 [NSApp removeWindowsItem:self]; | 38 [NSApp removeWindowsItem:self]; |
| 37 | 39 |
| 38 [super dealloc]; | 40 [super dealloc]; |
| 39 } | 41 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 91 |
| 90 // Explicitly enable |-performClose:| (see above); otherwise the fact that | 92 // Explicitly enable |-performClose:| (see above); otherwise the fact that |
| 91 // this window does not have a close button results in it being disabled. | 93 // this window does not have a close button results in it being disabled. |
| 92 if (action == @selector(performClose:)) | 94 if (action == @selector(performClose:)) |
| 93 return YES; | 95 return YES; |
| 94 | 96 |
| 95 return [super validateUserInterfaceItem:item]; | 97 return [super validateUserInterfaceItem:item]; |
| 96 } | 98 } |
| 97 | 99 |
| 98 @end | 100 @end |
| OLD | NEW |