| 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 | 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 | 16 // as a NSWindow's contentView. It is needed because NSWindow's implementation |
| 17 // explicitly resizes the contentView at inopportune times. | 17 // explicitly resizes the contentView at inopportune times. |
| 18 @interface FullSizeContentView : NSView | |
| 19 @end | |
| 20 | 18 |
| 21 @implementation FullSizeContentView | 19 @implementation FullSizeContentView |
| 22 | 20 |
| 23 // This method is directly called by AppKit during a live window resize. | 21 // This method is directly called by AppKit during a live window resize. |
| 24 // Override it to prevent the content view from shrinking. | 22 // Override it to prevent the content view from shrinking. |
| 25 - (void)setFrameSize:(NSSize)size { | 23 - (void)setFrameSize:(NSSize)size { |
| 26 if ([self superview]) | 24 if ([self superview]) |
| 27 size = [[self superview] bounds].size; | 25 size = [[self superview] bounds].size; |
| 28 [super setFrameSize:size]; | 26 [super setFrameSize:size]; |
| 29 } | 27 } |
| 30 | 28 |
| 29 - (void)forceFrameSize:(NSSize)size { |
| 30 [super setFrameSize:size]; |
| 31 } |
| 32 |
| 31 @end | 33 @end |
| 32 | 34 |
| 33 @implementation FullSizeContentWindow | 35 @implementation FullSizeContentWindow |
| 34 | 36 |
| 35 #pragma mark - Lifecycle | 37 #pragma mark - Lifecycle |
| 36 | 38 |
| 37 - (instancetype)init { | 39 - (instancetype)init { |
| 38 NOTREACHED(); | 40 NOTREACHED(); |
| 39 return nil; | 41 return nil; |
| 40 } | 42 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return [super contentRectForFrameRect:fRect styleMask:aStyle]; | 109 return [super contentRectForFrameRect:fRect styleMask:aStyle]; |
| 108 } | 110 } |
| 109 | 111 |
| 110 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { | 112 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { |
| 111 if (chromeWindowView_) | 113 if (chromeWindowView_) |
| 112 return frameRect; | 114 return frameRect; |
| 113 return [super contentRectForFrameRect:frameRect]; | 115 return [super contentRectForFrameRect:frameRect]; |
| 114 } | 116 } |
| 115 | 117 |
| 116 @end | 118 @end |
| OLD | NEW |