| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/full_size_content_window.h" | 5 #import "chrome/browser/ui/cocoa/full_size_content_window.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 @interface FullSizeContentWindow () | 9 @interface FullSizeContentWindow () |
| 10 | 10 |
| 11 + (BOOL)shouldUseFullSizeContentViewForStyle:(NSUInteger)windowStyle; | 11 + (BOOL)shouldUseFullSizeContentViewForStyle:(NSUInteger)windowStyle; |
| 12 | 12 |
| 13 @end | 13 @end |
| 14 | 14 |
| 15 // This view always takes the size of its superview. It is intended to be used | |
| 16 // as a NSWindow's contentView. It is needed because NSWindow's implementation | |
| 17 // explicitly resizes the contentView at inopportune times. | |
| 18 @interface FullSizeContentView : NSView | |
| 19 @end | |
| 20 | |
| 21 @implementation FullSizeContentView | 15 @implementation FullSizeContentView |
| 22 | 16 |
| 23 // This method is directly called by AppKit during a live window resize. | |
| 24 // Override it to prevent the content view from shrinking. | |
| 25 - (void)setFrameSize:(NSSize)size { | 17 - (void)setFrameSize:(NSSize)size { |
| 26 if ([self superview]) | 18 if ([self superview]) |
| 27 size = [[self superview] bounds].size; | 19 size = [[self superview] bounds].size; |
| 28 [super setFrameSize:size]; | 20 [super setFrameSize:size]; |
| 29 } | 21 } |
| 30 | 22 |
| 23 - (void)forceFrameSize:(NSSize)size { |
| 24 [super setFrameSize:size]; |
| 25 } |
| 26 |
| 31 @end | 27 @end |
| 32 | 28 |
| 33 @implementation FullSizeContentWindow | 29 @implementation FullSizeContentWindow |
| 34 | 30 |
| 35 #pragma mark - Lifecycle | 31 #pragma mark - Lifecycle |
| 36 | 32 |
| 37 - (instancetype)init { | 33 - (instancetype)init { |
| 38 NOTREACHED(); | 34 NOTREACHED(); |
| 39 return nil; | 35 return nil; |
| 40 } | 36 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return [super contentRectForFrameRect:fRect styleMask:aStyle]; | 103 return [super contentRectForFrameRect:fRect styleMask:aStyle]; |
| 108 } | 104 } |
| 109 | 105 |
| 110 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 106 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 111 if (chromeWindowView_) | 107 if (chromeWindowView_) |
| 112 return frameRect; | 108 return frameRect; |
| 113 return [super contentRectForFrameRect:frameRect]; | 109 return [super contentRectForFrameRect:frameRect]; |
| 114 } | 110 } |
| 115 | 111 |
| 116 @end | 112 @end |
| OLD | NEW |