Chromium Code Reviews| 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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 984 | 984 |
| 985 [window setFrame:windowFrame display:NO]; | 985 [window setFrame:windowFrame display:NO]; |
| 986 [chromeContentView setAutoresizesSubviews:autoresizesSubviews]; | 986 [chromeContentView setAutoresizesSubviews:autoresizesSubviews]; |
| 987 return YES; | 987 return YES; |
| 988 } | 988 } |
| 989 | 989 |
| 990 // Main method to resize browser window subviews. This method should be called | 990 // Main method to resize browser window subviews. This method should be called |
| 991 // when resizing any child of the content view, rather than resizing the views | 991 // when resizing any child of the content view, rather than resizing the views |
| 992 // directly. If the view is already the correct height, does not force a | 992 // directly. If the view is already the correct height, does not force a |
| 993 // relayout. | 993 // relayout. |
| 994 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { | 994 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { |
|
tapted
2015/10/12 23:56:43
BWC is a `ViewResizer` -- AnimatableView's delegat
dominickn
2015/10/15 06:22:27
Done. This eliminates the need to call layoutSubvi
| |
| 995 // We should only ever be called for one of the following four views. | 995 // We should only ever be called for one of the following four views. |
| 996 // |downloadShelfController_| may be nil. If we are asked to size the bookmark | 996 // |downloadShelfController_| may be nil. If we are asked to size the bookmark |
| 997 // bar directly, its superview must be this controller's content view. | 997 // bar directly, its superview must be this controller's content view. |
| 998 DCHECK(view); | 998 DCHECK(view); |
| 999 DCHECK(view == [toolbarController_ view] || | 999 DCHECK(view == [toolbarController_ view] || |
| 1000 view == [infoBarContainerController_ view] || | 1000 view == [infoBarContainerController_ view] || |
| 1001 view == [downloadShelfController_ view] || | 1001 view == [downloadShelfController_ view] || |
| 1002 view == [bookmarkBarController_ view]); | 1002 view == [bookmarkBarController_ view]); |
| 1003 | 1003 |
| 1004 // The infobar has insufficient information to determine its new height. It | 1004 // The infobar has insufficient information to determine its new height. It |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1889 | 1889 |
| 1890 - (void)executeExtensionCommand:(const std::string&)extension_id | 1890 - (void)executeExtensionCommand:(const std::string&)extension_id |
| 1891 command:(const extensions::Command&)command { | 1891 command:(const extensions::Command&)command { |
| 1892 // Global commands are handled by the ExtensionCommandsGlobalRegistry | 1892 // Global commands are handled by the ExtensionCommandsGlobalRegistry |
| 1893 // instance. | 1893 // instance. |
| 1894 DCHECK(!command.global()); | 1894 DCHECK(!command.global()); |
| 1895 extension_keybinding_registry_->ExecuteCommand(extension_id, | 1895 extension_keybinding_registry_->ExecuteCommand(extension_id, |
| 1896 command.accelerator()); | 1896 command.accelerator()); |
| 1897 } | 1897 } |
| 1898 | 1898 |
| 1899 - (void)updateToolbarVisibility:(BOOL)visible | |
| 1900 withAnimation:(BOOL)animate { | |
| 1901 // The toolbar section of the window layout must be redrawn when its | |
| 1902 // visibility changes. Otherwise, when the toolbar is not visible, its section | |
| 1903 // of the UI remains as an empty gray bar rather than not being drawn at all. | |
| 1904 [toolbarController_ updateVisibility:visible withAnimation:animate]; | |
| 1905 [self layoutSubviews]; | |
| 1906 } | |
| 1907 | |
| 1899 @end // @implementation BrowserWindowController | 1908 @end // @implementation BrowserWindowController |
| 1900 | 1909 |
| 1901 @implementation BrowserWindowController(Fullscreen) | 1910 @implementation BrowserWindowController(Fullscreen) |
| 1902 | 1911 |
| 1903 - (void)handleLionToggleFullscreen { | 1912 - (void)handleLionToggleFullscreen { |
| 1904 DCHECK(base::mac::IsOSLionOrLater()); | 1913 DCHECK(base::mac::IsOSLionOrLater()); |
| 1905 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); | 1914 chrome::ExecuteCommand(browser_.get(), IDC_FULLSCREEN); |
| 1906 } | 1915 } |
| 1907 | 1916 |
| 1908 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar { | 1917 - (void)enterBrowserFullscreenWithToolbar:(BOOL)withToolbar { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2061 | 2070 |
| 2062 - (BOOL)supportsBookmarkBar { | 2071 - (BOOL)supportsBookmarkBar { |
| 2063 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2072 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2064 } | 2073 } |
| 2065 | 2074 |
| 2066 - (BOOL)isTabbedWindow { | 2075 - (BOOL)isTabbedWindow { |
| 2067 return browser_->is_type_tabbed(); | 2076 return browser_->is_type_tabbed(); |
| 2068 } | 2077 } |
| 2069 | 2078 |
| 2070 @end // @implementation BrowserWindowController(WindowType) | 2079 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |