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 25 matching lines...) Expand all Loading... |
36 #include "chrome/browser/ui/browser_command_controller.h" | 36 #include "chrome/browser/ui/browser_command_controller.h" |
37 #include "chrome/browser/ui/browser_commands.h" | 37 #include "chrome/browser/ui/browser_commands.h" |
38 #include "chrome/browser/ui/browser_instant_controller.h" | 38 #include "chrome/browser/ui/browser_instant_controller.h" |
39 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
40 #include "chrome/browser/ui/browser_window_state.h" | 40 #include "chrome/browser/ui/browser_window_state.h" |
41 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 41 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
42 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 42 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
43 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" | 43 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" |
44 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 44 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
45 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 45 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 46 #import "chrome/browser/ui/cocoa/browser_window_layout.h" |
46 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 47 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
47 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" | 48 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con
troller.h" |
48 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" | 49 #import "chrome/browser/ui/cocoa/dev_tools_controller.h" |
49 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 50 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
50 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" | 51 #include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa
.h" |
51 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 52 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
52 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 53 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
53 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 54 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
54 #import "chrome/browser/ui/cocoa/framed_browser_window.h" | 55 #import "chrome/browser/ui/cocoa/framed_browser_window.h" |
55 #import "chrome/browser/ui/cocoa/fullscreen_window.h" | 56 #import "chrome/browser/ui/cocoa/fullscreen_window.h" |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { | 956 - (void)resizeView:(NSView*)view newHeight:(CGFloat)height { |
956 // We should only ever be called for one of the following four views. | 957 // We should only ever be called for one of the following four views. |
957 // |downloadShelfController_| may be nil. If we are asked to size the bookmark | 958 // |downloadShelfController_| may be nil. If we are asked to size the bookmark |
958 // bar directly, its superview must be this controller's content view. | 959 // bar directly, its superview must be this controller's content view. |
959 DCHECK(view); | 960 DCHECK(view); |
960 DCHECK(view == [toolbarController_ view] || | 961 DCHECK(view == [toolbarController_ view] || |
961 view == [infoBarContainerController_ view] || | 962 view == [infoBarContainerController_ view] || |
962 view == [downloadShelfController_ view] || | 963 view == [downloadShelfController_ view] || |
963 view == [bookmarkBarController_ view]); | 964 view == [bookmarkBarController_ view]); |
964 | 965 |
| 966 // The infobar has insufficient information to determine its new height. It |
| 967 // knows the total height of all of the info bars (which is what it passes |
| 968 // into this method), but knows nothing about the maximum arrow height, which |
| 969 // is determined by the toolbar. |
| 970 if (view == [infoBarContainerController_ view]) { |
| 971 height += [BrowserWindowLayout |
| 972 infoBarContainerHeightFromInfoBarHeight:height |
| 973 maxTopArrowHeight: |
| 974 [self infoBarMaxTopArrowHeight]]; |
| 975 } |
| 976 |
965 // Change the height of the view and call |-layoutSubViews|. We set the height | 977 // Change the height of the view and call |-layoutSubViews|. We set the height |
966 // here without regard to where the view is on the screen or whether it needs | 978 // here without regard to where the view is on the screen or whether it needs |
967 // to "grow up" or "grow down." The below call to |-layoutSubviews| will | 979 // to "grow up" or "grow down." The below call to |-layoutSubviews| will |
968 // position each view correctly. | 980 // position each view correctly. |
969 NSRect frame = [view frame]; | 981 NSRect frame = [view frame]; |
970 if (NSHeight(frame) == height) | 982 if (NSHeight(frame) == height) |
971 return; | 983 return; |
972 | 984 |
973 // Disable screen updates to prevent flickering. | 985 // Disable screen updates to prevent flickering. |
974 gfx::ScopedNSDisableScreenUpdates disabler; | 986 gfx::ScopedNSDisableScreenUpdates disabler; |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 return downloadShelfController_; | 1569 return downloadShelfController_; |
1558 } | 1570 } |
1559 | 1571 |
1560 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { | 1572 - (void)addFindBar:(FindBarCocoaController*)findBarCocoaController { |
1561 // Shouldn't call addFindBar twice. | 1573 // Shouldn't call addFindBar twice. |
1562 DCHECK(!findBarCocoaController_.get()); | 1574 DCHECK(!findBarCocoaController_.get()); |
1563 | 1575 |
1564 // Create a controller for the findbar. | 1576 // Create a controller for the findbar. |
1565 findBarCocoaController_.reset([findBarCocoaController retain]); | 1577 findBarCocoaController_.reset([findBarCocoaController retain]); |
1566 [self layoutSubviews]; | 1578 [self layoutSubviews]; |
1567 [self updateSubviewZOrder:[self isInFullscreenWithOmniboxSliding]]; | 1579 [self updateSubviewZOrder]; |
1568 } | 1580 } |
1569 | 1581 |
1570 - (NSWindow*)createFullscreenWindow { | 1582 - (NSWindow*)createFullscreenWindow { |
1571 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] | 1583 return [[[FullscreenWindow alloc] initForScreen:[[self window] screen]] |
1572 autorelease]; | 1584 autorelease]; |
1573 } | 1585 } |
1574 | 1586 |
1575 - (NSInteger)numberOfTabs { | 1587 - (NSInteger)numberOfTabs { |
1576 // count() includes pinned tabs. | 1588 // count() includes pinned tabs. |
1577 return browser_->tab_strip_model()->count(); | 1589 return browser_->tab_strip_model()->count(); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2196 | 2208 |
2197 - (BOOL)supportsBookmarkBar { | 2209 - (BOOL)supportsBookmarkBar { |
2198 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2210 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2199 } | 2211 } |
2200 | 2212 |
2201 - (BOOL)isTabbedWindow { | 2213 - (BOOL)isTabbedWindow { |
2202 return browser_->is_type_tabbed(); | 2214 return browser_->is_type_tabbed(); |
2203 } | 2215 } |
2204 | 2216 |
2205 @end // @implementation BrowserWindowController(WindowType) | 2217 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |