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 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 // Update the bookmark bar. | 1604 // Update the bookmark bar. |
1605 // Must do it after devtools updates, otherwise bookmark bar might | 1605 // Must do it after devtools updates, otherwise bookmark bar might |
1606 // call resizeView -> layoutSubviews and cause unnecessary relayout. | 1606 // call resizeView -> layoutSubviews and cause unnecessary relayout. |
1607 // TODO(viettrungluu): perhaps update to not terminate running animations (if | 1607 // TODO(viettrungluu): perhaps update to not terminate running animations (if |
1608 // applicable)? | 1608 // applicable)? |
1609 windowShim_->BookmarkBarStateChanged( | 1609 windowShim_->BookmarkBarStateChanged( |
1610 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 1610 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
1611 | 1611 |
1612 [infoBarContainerController_ changeWebContents:contents]; | 1612 [infoBarContainerController_ changeWebContents:contents]; |
1613 | 1613 |
1614 [overlayableContentsController_ onActivateTabWithContents:contents]; | |
1615 | |
1616 [self updateAllowOverlappingViews:[self inPresentationMode]]; | 1614 [self updateAllowOverlappingViews:[self inPresentationMode]]; |
1617 } | 1615 } |
1618 | 1616 |
1619 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change | 1617 - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change |
1620 withContents:(WebContents*)contents { | 1618 withContents:(WebContents*)contents { |
1621 // Update titles if this is the currently selected tab and if it isn't just | 1619 // Update titles if this is the currently selected tab and if it isn't just |
1622 // the loading state which changed. | 1620 // the loading state which changed. |
1623 if (change != TabStripModelObserver::LOADING_ONLY) | 1621 if (change != TabStripModelObserver::LOADING_ONLY) |
1624 windowShim_->UpdateTitleBar(); | 1622 windowShim_->UpdateTitleBar(); |
1625 | 1623 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 | 1942 |
1945 // Adjust to account for height and possible bookmark bar. Compress by 1 | 1943 // Adjust to account for height and possible bookmark bar. Compress by 1 |
1946 // to account for the separator. | 1944 // to account for the separator. |
1947 anchorRect.origin.y = | 1945 anchorRect.origin.y = |
1948 NSMaxY(anchorRect) - [toolbarController_ desiredHeightForCompression:1]; | 1946 NSMaxY(anchorRect) - [toolbarController_ desiredHeightForCompression:1]; |
1949 | 1947 |
1950 // Shift to window base coordinates. | 1948 // Shift to window base coordinates. |
1951 return [[toolbarView superview] convertRect:anchorRect toView:nil]; | 1949 return [[toolbarView superview] convertRect:anchorRect toView:nil]; |
1952 } | 1950 } |
1953 | 1951 |
1954 - (NSRect)instantFrame { | |
1955 // The view's bounds are in its own coordinate system. Convert that to the | |
1956 // window base coordinate system, then translate it into the screen's | |
1957 // coordinate system. | |
1958 NSView* view = [overlayableContentsController_ view]; | |
1959 if (!view) | |
1960 return NSZeroRect; | |
1961 | |
1962 NSRect frame = [view convertRect:[view bounds] toView:nil]; | |
1963 NSPoint originInScreenCoords = | |
1964 [[view window] convertBaseToScreen:frame.origin]; | |
1965 frame.origin = originInScreenCoords; | |
1966 | |
1967 // Account for the bookmark bar height if it is currently in the detached | |
1968 // state on the new tab page. | |
1969 if ([bookmarkBarController_ isInState:BookmarkBar::DETACHED]) | |
1970 frame.size.height += NSHeight([[bookmarkBarController_ view] bounds]); | |
1971 | |
1972 return frame; | |
1973 } | |
1974 | |
1975 - (void)sheetDidEnd:(NSWindow*)sheet | 1952 - (void)sheetDidEnd:(NSWindow*)sheet |
1976 returnCode:(NSInteger)code | 1953 returnCode:(NSInteger)code |
1977 context:(void*)context { | 1954 context:(void*)context { |
1978 [sheet orderOut:self]; | 1955 [sheet orderOut:self]; |
1979 } | 1956 } |
1980 | 1957 |
1981 - (void)onFindBarVisibilityChanged { | 1958 - (void)onFindBarVisibilityChanged { |
1982 [self updateAllowOverlappingViews:[self inPresentationMode]]; | 1959 [self updateAllowOverlappingViews:[self inPresentationMode]]; |
1983 } | 1960 } |
1984 | 1961 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 | 2235 |
2259 - (BOOL)supportsBookmarkBar { | 2236 - (BOOL)supportsBookmarkBar { |
2260 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2237 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2261 } | 2238 } |
2262 | 2239 |
2263 - (BOOL)isTabbedWindow { | 2240 - (BOOL)isTabbedWindow { |
2264 return browser_->is_type_tabbed(); | 2241 return browser_->is_type_tabbed(); |
2265 } | 2242 } |
2266 | 2243 |
2267 @end // @implementation BrowserWindowController(WindowType) | 2244 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |