Skip to content

Commit

Permalink
[Mac] Remove the "Exit Fullscreen" Touch Bar Button
Browse files Browse the repository at this point in the history
Bug: 818055
Change-Id: Ia0f8ee535c45ede4047e02f068def70e538b8524
Reviewed-on: https://chromium-review.googlesource.com/946740
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540648}
  • Loading branch information
spqchan authored and Commit Bot committed Mar 2, 2018
1 parent a5628ad commit f2ae6ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
34 changes: 3 additions & 31 deletions chrome/browser/ui/cocoa/browser_window_touch_bar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
NSString* const kSearchTouchId = @"SEARCH";
NSString* const kStarTouchId = @"BOOKMARK";
NSString* const kNewTabTouchId = @"NEW-TAB";
NSString* const kExitFullscreenTouchId = @"EXIT-FULLSCREEN";
NSString* const kFullscreenOriginLabelTouchId = @"FULLSCREEN-ORIGIN-LABEL";

// The button indexes in the back and forward segment control.
Expand Down Expand Up @@ -343,8 +342,6 @@ - (NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar

[touchBarItem
setView:[NSTextField labelWithAttributedString:attributedString.get()]];
} else if ([identifier hasSuffix:kExitFullscreenTouchId]) {
return nil;
}

return touchBarItem.autorelease();
Expand All @@ -353,28 +350,9 @@ - (NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
- (NSTouchBar*)createTabFullscreenTouchBar API_AVAILABLE(macos(10.12.2)) {
base::scoped_nsobject<NSTouchBar> touchBar([[ui::NSTouchBar() alloc] init]);
[touchBar setDelegate:self];

if ([touchBar respondsToSelector:
@selector(setEscapeKeyReplacementItemIdentifier:)]) {
NSString* exitIdentifier =
ui::GetTouchBarItemId(kTabFullscreenTouchBarId, kExitFullscreenTouchId);
[touchBar setEscapeKeyReplacementItemIdentifier:exitIdentifier];
[touchBar setDefaultItemIdentifiers:@[ ui::GetTouchBarItemId(
kTabFullscreenTouchBarId,
kFullscreenOriginLabelTouchId) ]];

base::scoped_nsobject<NSCustomTouchBarItem> touchBarItem(
[[ui::NSCustomTouchBarItem() alloc] initWithIdentifier:exitIdentifier]);

[touchBarItem
setView:[NSButton buttonWithTitle:l10n_util::GetNSString(
IDS_TOUCH_BAR_EXIT_FULLSCREEN)
target:self
action:@selector(exitFullscreenForTab:)]];
[touchBar
setTemplateItems:[NSSet setWithObject:touchBarItem.autorelease()]];
}

[touchBar setDefaultItemIdentifiers:@[ ui::GetTouchBarItemId(
kTabFullscreenTouchBarId,
kFullscreenOriginLabelTouchId) ]];
return touchBar.autorelease();
}

Expand Down Expand Up @@ -499,12 +477,6 @@ - (void)backOrForward:(id)sender {
commandUpdater_->ExecuteCommand(command);
}

- (void)exitFullscreenForTab:(id)sender {
browser_->exclusive_access_manager()
->fullscreen_controller()
->ExitExclusiveAccessIfNecessary();
}

- (void)executeCommand:(id)sender {
int command = [sender tag];
ui::LogTouchBarUMA(TouchBarActionFromCommand(command));
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/ui/cocoa/browser_window_touch_bar_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
NSString* const kSearchTouchId = @"SEARCH";
NSString* const kStarTouchId = @"BOOKMARK";
NSString* const kNewTabTouchId = @"NEW-TAB";
NSString* const kExitFullscreenTouchId = @"EXIT-FULLSCREEN";
NSString* const kFullscreenOriginLabelTouchId = @"FULLSCREEN-ORIGIN-LABEL";

// The button indexes in the back and forward segment control.
Expand Down Expand Up @@ -110,8 +109,6 @@ void UpdateCommandEnabled(int id, bool enabled) {
EXPECT_TRUE(
[touch_bar_items containsObject:GetFullscreenTouchBarItemId(
kFullscreenOriginLabelTouchId)]);
EXPECT_TRUE([[touch_bar escapeKeyReplacementItemIdentifier]
isEqualToString:GetFullscreenTouchBarItemId(kExitFullscreenTouchId)]);

BOOL no = NO;
[[[bwc() stub] andReturnValue:OCMOCK_VALUE(no)]
Expand Down

0 comments on commit f2ae6ac

Please sign in to comment.