Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 2741343008: [Mac] Add Home button to Default Touch Bar (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 } 1000 }
1001 1001
1002 - (void)resetTabState:(WebContents*)tab { 1002 - (void)resetTabState:(WebContents*)tab {
1003 [toolbarController_ resetTabState:tab]; 1003 [toolbarController_ resetTabState:tab];
1004 } 1004 }
1005 1005
1006 - (void)setStarredState:(BOOL)isStarred { 1006 - (void)setStarredState:(BOOL)isStarred {
1007 [toolbarController_ setStarredState:isStarred]; 1007 [toolbarController_ setStarredState:isStarred];
1008 1008
1009 [touchBar_ setIsStarred:isStarred]; 1009 [touchBar_ setIsStarred:isStarred];
1010 if ([[self window] respondsToSelector:@selector(setTouchBar:)]) 1010 [self invalidateTouchBar];
1011 [[self window] performSelector:@selector(setTouchBar:) withObject:nil];
1012 } 1011 }
1013 1012
1014 - (void)setCurrentPageIsTranslated:(BOOL)on { 1013 - (void)setCurrentPageIsTranslated:(BOOL)on {
1015 [toolbarController_ setTranslateIconLit:on]; 1014 [toolbarController_ setTranslateIconLit:on];
1016 } 1015 }
1017 1016
1018 - (void)onActiveTabChanged:(content::WebContents*)oldContents 1017 - (void)onActiveTabChanged:(content::WebContents*)oldContents
1019 to:(content::WebContents*)newContents { 1018 to:(content::WebContents*)newContents {
1020 // No need to remove previous bubble. It will close itself. 1019 // No need to remove previous bubble. It will close itself.
1021 PermissionRequestManager* manager(nullptr); 1020 PermissionRequestManager* manager(nullptr);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 return [tabStripController_ tabViews]; 1139 return [tabStripController_ tabViews];
1141 } 1140 }
1142 1141
1143 - (NSView*)activeTabView { 1142 - (NSView*)activeTabView {
1144 return [tabStripController_ activeTabView]; 1143 return [tabStripController_ activeTabView];
1145 } 1144 }
1146 1145
1147 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force { 1146 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force {
1148 [toolbarController_ setIsLoading:isLoading force:force]; 1147 [toolbarController_ setIsLoading:isLoading force:force];
1149 [touchBar_ setIsPageLoading:isLoading]; 1148 [touchBar_ setIsPageLoading:isLoading];
1150 if ([[self window] respondsToSelector:@selector(setTouchBar:)]) 1149 [self invalidateTouchBar];
1151 [[self window] performSelector:@selector(setTouchBar:) withObject:nil];
1152 } 1150 }
1153 1151
1154 // Make the location bar the first responder, if possible. 1152 // Make the location bar the first responder, if possible.
1155 - (void)focusLocationBar:(BOOL)selectAll { 1153 - (void)focusLocationBar:(BOOL)selectAll {
1156 [toolbarController_ focusLocationBar:selectAll]; 1154 [toolbarController_ focusLocationBar:selectAll];
1157 } 1155 }
1158 1156
1159 - (void)focusTabContents { 1157 - (void)focusTabContents {
1160 content::WebContents* const activeWebContents = 1158 content::WebContents* const activeWebContents =
1161 browser_->tab_strip_model()->GetActiveWebContents(); 1159 browser_->tab_strip_model()->GetActiveWebContents();
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 static_cast<BrowserWindowCocoa*>([self browserWindow]) 1842 static_cast<BrowserWindowCocoa*>([self browserWindow])
1845 ->UpdateAlertState(alertState); 1843 ->UpdateAlertState(alertState);
1846 } 1844 }
1847 1845
1848 - (TabAlertState)alertState { 1846 - (TabAlertState)alertState {
1849 return static_cast<BrowserWindowCocoa*>([self browserWindow])->alert_state(); 1847 return static_cast<BrowserWindowCocoa*>([self browserWindow])->alert_state();
1850 } 1848 }
1851 1849
1852 - (BrowserWindowTouchBar*)browserWindowTouchBar { 1850 - (BrowserWindowTouchBar*)browserWindowTouchBar {
1853 if (!touchBar_) { 1851 if (!touchBar_) {
1854 touchBar_.reset( 1852 touchBar_.reset([[BrowserWindowTouchBar alloc]
1855 [[BrowserWindowTouchBar alloc] initWithBrowser:browser_.get()]); 1853 initWithBrowser:browser_.get()
1854 browserWindowController:self]);
1856 } 1855 }
1857 1856
1858 return touchBar_.get(); 1857 return touchBar_.get();
1859 } 1858 }
1860 1859
1860 - (void)invalidateTouchBar {
1861 if ([[self window] respondsToSelector:@selector(setTouchBar:)])
1862 [[self window] performSelector:@selector(setTouchBar:) withObject:nil];
1863 }
1864
1861 @end // @implementation BrowserWindowController 1865 @end // @implementation BrowserWindowController
1862 1866
1863 @implementation BrowserWindowController(Fullscreen) 1867 @implementation BrowserWindowController(Fullscreen)
1864 1868
1865 - (void)enterBrowserFullscreen { 1869 - (void)enterBrowserFullscreen {
1866 [self enterAppKitFullscreen]; 1870 [self enterAppKitFullscreen];
1867 } 1871 }
1868 1872
1869 - (void)updateUIForTabFullscreen: 1873 - (void)updateUIForTabFullscreen:
1870 (ExclusiveAccessContext::TabFullscreenState)state { 1874 (ExclusiveAccessContext::TabFullscreenState)state {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2026
2023 - (NSRect)savedRegularWindowFrame { 2027 - (NSRect)savedRegularWindowFrame {
2024 return savedRegularWindowFrame_; 2028 return savedRegularWindowFrame_;
2025 } 2029 }
2026 2030
2027 - (BOOL)isFullscreenTransitionInProgress { 2031 - (BOOL)isFullscreenTransitionInProgress {
2028 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_; 2032 return enteringAppKitFullscreen_ || exitingAppKitFullscreen_;
2029 } 2033 }
2030 2034
2031 @end // @implementation BrowserWindowController(WindowType) 2035 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.h ('k') | chrome/browser/ui/cocoa/browser_window_touch_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698