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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 } | 1002 } |
1003 | 1003 |
1004 - (void)resetTabState:(WebContents*)tab { | 1004 - (void)resetTabState:(WebContents*)tab { |
1005 [toolbarController_ resetTabState:tab]; | 1005 [toolbarController_ resetTabState:tab]; |
1006 } | 1006 } |
1007 | 1007 |
1008 - (void)setStarredState:(BOOL)isStarred { | 1008 - (void)setStarredState:(BOOL)isStarred { |
1009 [toolbarController_ setStarredState:isStarred]; | 1009 [toolbarController_ setStarredState:isStarred]; |
1010 | 1010 |
1011 [touchBar_ setIsStarred:isStarred]; | 1011 [touchBar_ setIsStarred:isStarred]; |
1012 if ([[self window] respondsToSelector:@selector(setTouchBar:)]) | 1012 [self invalidateTouchBar]; |
1013 [[self window] performSelector:@selector(setTouchBar:) withObject:nil]; | |
1014 } | 1013 } |
1015 | 1014 |
1016 - (void)setCurrentPageIsTranslated:(BOOL)on { | 1015 - (void)setCurrentPageIsTranslated:(BOOL)on { |
1017 [toolbarController_ setTranslateIconLit:on]; | 1016 [toolbarController_ setTranslateIconLit:on]; |
1018 } | 1017 } |
1019 | 1018 |
1020 - (void)onActiveTabChanged:(content::WebContents*)oldContents | 1019 - (void)onActiveTabChanged:(content::WebContents*)oldContents |
1021 to:(content::WebContents*)newContents { | 1020 to:(content::WebContents*)newContents { |
1022 // No need to remove previous bubble. It will close itself. | 1021 // No need to remove previous bubble. It will close itself. |
1023 PermissionRequestManager* manager(nullptr); | 1022 PermissionRequestManager* manager(nullptr); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 return [tabStripController_ tabViews]; | 1145 return [tabStripController_ tabViews]; |
1147 } | 1146 } |
1148 | 1147 |
1149 - (NSView*)activeTabView { | 1148 - (NSView*)activeTabView { |
1150 return [tabStripController_ activeTabView]; | 1149 return [tabStripController_ activeTabView]; |
1151 } | 1150 } |
1152 | 1151 |
1153 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force { | 1152 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force { |
1154 [toolbarController_ setIsLoading:isLoading force:force]; | 1153 [toolbarController_ setIsLoading:isLoading force:force]; |
1155 [touchBar_ setIsPageLoading:isLoading]; | 1154 [touchBar_ setIsPageLoading:isLoading]; |
1156 if ([[self window] respondsToSelector:@selector(setTouchBar:)]) | 1155 [self invalidateTouchBar]; |
1157 [[self window] performSelector:@selector(setTouchBar:) withObject:nil]; | |
1158 } | 1156 } |
1159 | 1157 |
1160 // Make the location bar the first responder, if possible. | 1158 // Make the location bar the first responder, if possible. |
1161 - (void)focusLocationBar:(BOOL)selectAll { | 1159 - (void)focusLocationBar:(BOOL)selectAll { |
1162 [toolbarController_ focusLocationBar:selectAll]; | 1160 [toolbarController_ focusLocationBar:selectAll]; |
1163 } | 1161 } |
1164 | 1162 |
1165 - (void)focusTabContents { | 1163 - (void)focusTabContents { |
1166 content::WebContents* const activeWebContents = | 1164 content::WebContents* const activeWebContents = |
1167 browser_->tab_strip_model()->GetActiveWebContents(); | 1165 browser_->tab_strip_model()->GetActiveWebContents(); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 static_cast<BrowserWindowCocoa*>([self browserWindow]) | 1850 static_cast<BrowserWindowCocoa*>([self browserWindow]) |
1853 ->UpdateAlertState(alertState); | 1851 ->UpdateAlertState(alertState); |
1854 } | 1852 } |
1855 | 1853 |
1856 - (TabAlertState)alertState { | 1854 - (TabAlertState)alertState { |
1857 return static_cast<BrowserWindowCocoa*>([self browserWindow])->alert_state(); | 1855 return static_cast<BrowserWindowCocoa*>([self browserWindow])->alert_state(); |
1858 } | 1856 } |
1859 | 1857 |
1860 - (BrowserWindowTouchBar*)browserWindowTouchBar { | 1858 - (BrowserWindowTouchBar*)browserWindowTouchBar { |
1861 if (!touchBar_) { | 1859 if (!touchBar_) { |
1862 touchBar_.reset( | 1860 touchBar_.reset([[BrowserWindowTouchBar alloc] |
1863 [[BrowserWindowTouchBar alloc] initWithBrowser:browser_.get()]); | 1861 initWithBrowser:browser_.get() |
| 1862 browserWindowController:self]); |
1864 } | 1863 } |
1865 | 1864 |
1866 return touchBar_.get(); | 1865 return touchBar_.get(); |
1867 } | 1866 } |
1868 | 1867 |
| 1868 - (void)invalidateTouchBar { |
| 1869 if ([[self window] respondsToSelector:@selector(setTouchBar:)]) |
| 1870 [[self window] performSelector:@selector(setTouchBar:) withObject:nil]; |
| 1871 } |
| 1872 |
1869 @end // @implementation BrowserWindowController | 1873 @end // @implementation BrowserWindowController |
1870 | 1874 |
1871 @implementation BrowserWindowController(Fullscreen) | 1875 @implementation BrowserWindowController(Fullscreen) |
1872 | 1876 |
1873 - (void)enterBrowserFullscreen { | 1877 - (void)enterBrowserFullscreen { |
1874 [self enterAppKitFullscreen]; | 1878 [self enterAppKitFullscreen]; |
1875 } | 1879 } |
1876 | 1880 |
1877 - (void)updateUIForTabFullscreen: | 1881 - (void)updateUIForTabFullscreen: |
1878 (ExclusiveAccessContext::TabFullscreenState)state { | 1882 (ExclusiveAccessContext::TabFullscreenState)state { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2034 |
2031 - (NSRect)savedRegularWindowFrame { | 2035 - (NSRect)savedRegularWindowFrame { |
2032 return savedRegularWindowFrame_; | 2036 return savedRegularWindowFrame_; |
2033 } | 2037 } |
2034 | 2038 |
2035 - (BOOL)isFullscreenTransitionInProgress { | 2039 - (BOOL)isFullscreenTransitionInProgress { |
2036 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; | 2040 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; |
2037 } | 2041 } |
2038 | 2042 |
2039 @end // @implementation BrowserWindowController(WindowType) | 2043 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |