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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 // saved user size. (It is possible for the two to coincide.) In this way, the | 720 // saved user size. (It is possible for the two to coincide.) In this way, the |
721 // zoom button acts as a toggle. We determine the standard size based on the | 721 // zoom button acts as a toggle. We determine the standard size based on the |
722 // content, but enforce a minimum width (calculated using the dimensions of the | 722 // content, but enforce a minimum width (calculated using the dimensions of the |
723 // screen) to ensure websites with small intrinsic width (such as google.com) | 723 // screen) to ensure websites with small intrinsic width (such as google.com) |
724 // don't end up with a wee window. Moreover, we always declare the standard | 724 // don't end up with a wee window. Moreover, we always declare the standard |
725 // width to be at least as big as the current width, i.e., we never want zooming | 725 // width to be at least as big as the current width, i.e., we never want zooming |
726 // to the standard width to shrink the window. This is consistent with other | 726 // to the standard width to shrink the window. This is consistent with other |
727 // browsers' behaviour, and is desirable in multi-tab situations. Note, however, | 727 // browsers' behaviour, and is desirable in multi-tab situations. Note, however, |
728 // that the "toggle" behaviour means that the window can still be "unzoomed" to | 728 // that the "toggle" behaviour means that the window can still be "unzoomed" to |
729 // the user size. | 729 // the user size. |
730 // Note: this method is also called from -isZoomed. If the returned zoomed rect | |
731 // equals the current window's frame, -isZoomed returns YES. | |
732 - (NSRect)windowWillUseStandardFrame:(NSWindow*)window | 730 - (NSRect)windowWillUseStandardFrame:(NSWindow*)window |
733 defaultFrame:(NSRect)frame { | 731 defaultFrame:(NSRect)frame { |
734 // Forget that we grew the window up (if we in fact did). | 732 // Forget that we grew the window up (if we in fact did). |
735 [self resetWindowGrowthState]; | 733 [self resetWindowGrowthState]; |
736 | 734 |
737 // |frame| already fills the current screen. Never touch y and height since we | 735 // |frame| already fills the current screen. Never touch y and height since we |
738 // always want to fill vertically. | 736 // always want to fill vertically. |
739 | 737 |
740 // If the shift key is down, maximize. Hopefully this should make the | 738 // If the shift key is down, maximize. Hopefully this should make the |
741 // "switchers" happy. | 739 // "switchers" happy. |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 | 2204 |
2207 - (BOOL)supportsBookmarkBar { | 2205 - (BOOL)supportsBookmarkBar { |
2208 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2206 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2209 } | 2207 } |
2210 | 2208 |
2211 - (BOOL)isTabbedWindow { | 2209 - (BOOL)isTabbedWindow { |
2212 return browser_->is_type_tabbed(); | 2210 return browser_->is_type_tabbed(); |
2213 } | 2211 } |
2214 | 2212 |
2215 @end // @implementation BrowserWindowController(WindowType) | 2213 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |