OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <numeric> | 8 #include <numeric> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 // (N.B.: These only record growth, not shrinkage.) | 939 // (N.B.: These only record growth, not shrinkage.) |
940 if (NSMaxY(windowFrame) > oldWindowMaxY) | 940 if (NSMaxY(windowFrame) > oldWindowMaxY) |
941 windowTopGrowth_ += NSMaxY(windowFrame) - oldWindowMaxY; | 941 windowTopGrowth_ += NSMaxY(windowFrame) - oldWindowMaxY; |
942 if (NSMinY(windowFrame) < oldWindowMinY) | 942 if (NSMinY(windowFrame) < oldWindowMinY) |
943 windowBottomGrowth_ += oldWindowMinY - NSMinY(windowFrame); | 943 windowBottomGrowth_ += oldWindowMinY - NSMinY(windowFrame); |
944 } | 944 } |
945 | 945 |
946 // Disable subview resizing while resizing the window, or else we will get | 946 // Disable subview resizing while resizing the window, or else we will get |
947 // unwanted renderer resizes. The calling code must call layoutSubviews to | 947 // unwanted renderer resizes. The calling code must call layoutSubviews to |
948 // make things right again. | 948 // make things right again. |
949 NSView* contentView = [window contentView]; | 949 NSView* chromeContentView = [self chromeContentView]; |
950 [contentView setAutoresizesSubviews:NO]; | 950 BOOL autoresizesSubviews = [chromeContentView autoresizesSubviews]; |
| 951 [chromeContentView setAutoresizesSubviews:NO]; |
951 [window setFrame:windowFrame display:NO]; | 952 [window setFrame:windowFrame display:NO]; |
952 [contentView setAutoresizesSubviews:YES]; | 953 [chromeContentView setAutoresizesSubviews:autoresizesSubviews]; |
953 return YES; | 954 return YES; |
954 } | 955 } |
955 | 956 |
956 // Main method to resize browser window subviews. This method should be called | 957 // Main method to resize browser window subviews. This method should be called |
957 // when resizing any child of the content view, rather than resizing the views | 958 // when resizing any child of the content view, rather than resizing the views |
958 // directly. If the view is already the correct height, does not force a | 959 // directly. If the view is already the correct height, does not force a |
959 // relayout. | 960 // relayout. |
960 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { | 961 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { |
961 // We should only ever be called for one of the following four views. | 962 // We should only ever be called for one of the following four views. |
962 // |downloadShelfController_| may be nil. If we are asked to size the bookmark | 963 // |downloadShelfController_| may be nil. If we are asked to size the bookmark |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1567 |
1567 - (BOOL)isDownloadShelfVisible { | 1568 - (BOOL)isDownloadShelfVisible { |
1568 return downloadShelfController_ != nil && | 1569 return downloadShelfController_ != nil && |
1569 [downloadShelfController_ isVisible]; | 1570 [downloadShelfController_ isVisible]; |
1570 } | 1571 } |
1571 | 1572 |
1572 - (void)createAndAddDownloadShelf { | 1573 - (void)createAndAddDownloadShelf { |
1573 if (!downloadShelfController_.get()) { | 1574 if (!downloadShelfController_.get()) { |
1574 downloadShelfController_.reset([[DownloadShelfController alloc] | 1575 downloadShelfController_.reset([[DownloadShelfController alloc] |
1575 initWithBrowser:browser_.get() resizeDelegate:self]); | 1576 initWithBrowser:browser_.get() resizeDelegate:self]); |
1576 [[[self window] contentView] addSubview:[downloadShelfController_ view]]; | 1577 [self.chromeContentView addSubview:[downloadShelfController_ view]]; |
1577 } | 1578 } |
1578 } | 1579 } |
1579 | 1580 |
1580 - (DownloadShelfController*)downloadShelf { | 1581 - (DownloadShelfController*)downloadShelf { |
1581 return downloadShelfController_; | 1582 return downloadShelfController_; |
1582 } | 1583 } |
1583 | 1584 |
1584 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1585 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
1585 // Shouldn't call addFindBar twice. | 1586 // Shouldn't call addFindBar twice. |
1586 DCHECK(!findBarCocoaController_.get()); | 1587 DCHECK(!findBarCocoaController_.get()); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2225 | 2226 |
2226 - (BOOL)supportsBookmarkBar { | 2227 - (BOOL)supportsBookmarkBar { |
2227 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2228 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2228 } | 2229 } |
2229 | 2230 |
2230 - (BOOL)isTabbedWindow { | 2231 - (BOOL)isTabbedWindow { |
2231 return browser_->is_type_tabbed(); | 2232 return browser_->is_type_tabbed(); |
2232 } | 2233 } |
2233 | 2234 |
2234 @end // @implementation BrowserWindowController(WindowType) | 2235 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |