| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 manager = PermissionBubbleManager::FromWebContents(oldContents); | 1021 manager = PermissionBubbleManager::FromWebContents(oldContents); |
| 1022 if (manager) | 1022 if (manager) |
| 1023 manager->HideBubble(); | 1023 manager->HideBubble(); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 if (newContents) { | 1026 if (newContents) { |
| 1027 manager = PermissionBubbleManager::FromWebContents(newContents); | 1027 manager = PermissionBubbleManager::FromWebContents(newContents); |
| 1028 if (manager) | 1028 if (manager) |
| 1029 manager->DisplayPendingRequests(); | 1029 manager->DisplayPendingRequests(); |
| 1030 } | 1030 } |
| 1031 |
| 1032 // If the web contents want to focus on the location bar, do not call the |
| 1033 // animation since the location bar will drop down when it's focused. |
| 1034 bool willFocusLocationBar = |
| 1035 newContents && newContents->FocusLocationBarByDefault(); |
| 1036 if ([self isInAnyFullscreenMode] && !willFocusLocationBar) |
| 1037 [[self presentationModeController] revealToolbarForTabStripChanges]; |
| 1031 } | 1038 } |
| 1032 | 1039 |
| 1033 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { | 1040 - (void)zoomChangedForActiveTab:(BOOL)canShowBubble { |
| 1034 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; | 1041 [toolbarController_ zoomChangedForActiveTab:canShowBubble]; |
| 1035 } | 1042 } |
| 1036 | 1043 |
| 1037 // Return the rect, in WebKit coordinates (flipped), of the window's grow box | 1044 // Return the rect, in WebKit coordinates (flipped), of the window's grow box |
| 1038 // in the coordinate system of the content area of the currently selected tab. | 1045 // in the coordinate system of the content area of the currently selected tab. |
| 1039 // |windowGrowBox| needs to be in the window's coordinate system. | 1046 // |windowGrowBox| needs to be in the window's coordinate system. |
| 1040 - (NSRect)selectedTabGrowBoxRect { | 1047 - (NSRect)selectedTabGrowBoxRect { |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 if (change != TabStripModelObserver::TITLE_NOT_LOADING) { | 1476 if (change != TabStripModelObserver::TITLE_NOT_LOADING) { |
| 1470 windowShim_->BookmarkBarStateChanged( | 1477 windowShim_->BookmarkBarStateChanged( |
| 1471 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 1478 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 1472 } | 1479 } |
| 1473 } | 1480 } |
| 1474 | 1481 |
| 1475 - (void)onTabDetachedWithContents:(WebContents*)contents { | 1482 - (void)onTabDetachedWithContents:(WebContents*)contents { |
| 1476 [infoBarContainerController_ tabDetachedWithContents:contents]; | 1483 [infoBarContainerController_ tabDetachedWithContents:contents]; |
| 1477 } | 1484 } |
| 1478 | 1485 |
| 1486 - (void)onTabInsertedInForeground:(BOOL)inForeground { |
| 1487 if ([self isInAnyFullscreenMode] && !inForeground && |
| 1488 ![toolbarController_ isLocationBarFocused]) { |
| 1489 [[self presentationModeController] revealToolbarForTabStripChanges]; |
| 1490 } |
| 1491 } |
| 1492 |
| 1479 - (void)userChangedTheme { | 1493 - (void)userChangedTheme { |
| 1480 NSView* rootView = [[[self window] contentView] superview]; | 1494 NSView* rootView = [[[self window] contentView] superview]; |
| 1481 [rootView cr_recursivelyInvokeBlock:^(id view) { | 1495 [rootView cr_recursivelyInvokeBlock:^(id view) { |
| 1482 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) | 1496 if ([view conformsToProtocol:@protocol(ThemedWindowDrawing)]) |
| 1483 [view windowDidChangeTheme]; | 1497 [view windowDidChangeTheme]; |
| 1484 | 1498 |
| 1485 // TODO(andresantoso): Remove this once all themed views respond to | 1499 // TODO(andresantoso): Remove this once all themed views respond to |
| 1486 // windowDidChangeTheme above. | 1500 // windowDidChangeTheme above. |
| 1487 [view setNeedsDisplay:YES]; | 1501 [view setNeedsDisplay:YES]; |
| 1488 }]; | 1502 }]; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 - (void)sheetDidEnd:(NSWindow*)sheet | 1831 - (void)sheetDidEnd:(NSWindow*)sheet |
| 1818 returnCode:(NSInteger)code | 1832 returnCode:(NSInteger)code |
| 1819 context:(void*)context { | 1833 context:(void*)context { |
| 1820 [sheet orderOut:self]; | 1834 [sheet orderOut:self]; |
| 1821 } | 1835 } |
| 1822 | 1836 |
| 1823 - (PresentationModeController*)presentationModeController { | 1837 - (PresentationModeController*)presentationModeController { |
| 1824 return presentationModeController_.get(); | 1838 return presentationModeController_.get(); |
| 1825 } | 1839 } |
| 1826 | 1840 |
| 1841 - (void)setPresentationModeController:(PresentationModeController*)controller { |
| 1842 presentationModeController_.reset([controller retain]); |
| 1843 } |
| 1844 |
| 1827 - (void)executeExtensionCommand:(const std::string&)extension_id | 1845 - (void)executeExtensionCommand:(const std::string&)extension_id |
| 1828 command:(const extensions::Command&)command { | 1846 command:(const extensions::Command&)command { |
| 1829 // Global commands are handled by the ExtensionCommandsGlobalRegistry | 1847 // Global commands are handled by the ExtensionCommandsGlobalRegistry |
| 1830 // instance. | 1848 // instance. |
| 1831 DCHECK(!command.global()); | 1849 DCHECK(!command.global()); |
| 1832 extension_keybinding_registry_->ExecuteCommand(extension_id, | 1850 extension_keybinding_registry_->ExecuteCommand(extension_id, |
| 1833 command.accelerator()); | 1851 command.accelerator()); |
| 1834 } | 1852 } |
| 1835 | 1853 |
| 1836 - (void)setAlertState:(TabAlertState)alertState { | 1854 - (void)setAlertState:(TabAlertState)alertState { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 | 2042 |
| 2025 - (NSRect)savedRegularWindowFrame { | 2043 - (NSRect)savedRegularWindowFrame { |
| 2026 return savedRegularWindowFrame_; | 2044 return savedRegularWindowFrame_; |
| 2027 } | 2045 } |
| 2028 | 2046 |
| 2029 - (BOOL)isFullscreenTransitionInProgress { | 2047 - (BOOL)isFullscreenTransitionInProgress { |
| 2030 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; | 2048 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; |
| 2031 } | 2049 } |
| 2032 | 2050 |
| 2033 @end // @implementation BrowserWindowController(WindowType) | 2051 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |