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

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

Issue 2078733002: [Mac] Fix Toolbar glimpse during fullscreen transition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 6 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
« no previous file with comments | « chrome/browser/ui/cocoa/presentation_mode_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/presentation_mode_controller.h" 5 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #import "base/mac/mac_util.h" 10 #import "base/mac/mac_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PresentationModeController* self = 45 PresentationModeController* self =
46 static_cast<PresentationModeController*>(context); 46 static_cast<PresentationModeController*>(context);
47 47
48 // If Chrome has multiple fullscreen windows in their own space, the Handler 48 // If Chrome has multiple fullscreen windows in their own space, the Handler
49 // becomes flaky and might start receiving kMenuBarRevealEventKind events 49 // becomes flaky and might start receiving kMenuBarRevealEventKind events
50 // from another space. Since the menubar in the another space is in either a 50 // from another space. Since the menubar in the another space is in either a
51 // shown or hidden state, it will give us a reveal fraction of 0.0 or 1.0. 51 // shown or hidden state, it will give us a reveal fraction of 0.0 or 1.0.
52 // As such, we should ignore the kMenuBarRevealEventKind event if it gives 52 // As such, we should ignore the kMenuBarRevealEventKind event if it gives
53 // us a fraction of 0.0 or 1.0, and rely on kEventMenuBarShown and 53 // us a fraction of 0.0 or 1.0, and rely on kEventMenuBarShown and
54 // kEventMenuBarHidden to set these values. 54 // kEventMenuBarHidden to set these values.
55 if ([self isMainWindow]) { 55 if ([self isMainWindow] && ![self isFullscreenTransitionInProgress]) {
56 if (GetEventKind(event) == kMenuBarRevealEventKind) { 56 if (GetEventKind(event) == kMenuBarRevealEventKind) {
57 CGFloat revealFraction = 0; 57 CGFloat revealFraction = 0;
58 GetEventParameter(event, FOUR_CHAR_CODE('rvlf'), typeCGFloat, NULL, 58 GetEventParameter(event, FOUR_CHAR_CODE('rvlf'), typeCGFloat, NULL,
59 sizeof(CGFloat), NULL, &revealFraction); 59 sizeof(CGFloat), NULL, &revealFraction);
60 if (revealFraction > 0.0 && revealFraction < 1.0) 60 if (revealFraction > 0.0 && revealFraction < 1.0)
61 [self setMenuBarRevealProgress:revealFraction]; 61 [self setMenuBarRevealProgress:revealFraction];
62 } else if (GetEventKind(event) == kEventMenuBarShown) { 62 } else if (GetEventKind(event) == kEventMenuBarShown) {
63 [self setMenuBarRevealProgress:1.0]; 63 [self setMenuBarRevealProgress:1.0];
64 } else { 64 } else {
65 [self setMenuBarRevealProgress:0.0]; 65 [self setMenuBarRevealProgress:0.0];
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // the logic is correct and not fragile. 419 // the logic is correct and not fragile.
420 - (CGFloat)menubarOffset { 420 - (CGFloat)menubarOffset {
421 if ([browserController_ isInAppKitFullscreen]) 421 if ([browserController_ isInAppKitFullscreen])
422 return -std::floor(menubarFraction_ * [self floatingBarVerticalOffset]); 422 return -std::floor(menubarFraction_ * [self floatingBarVerticalOffset]);
423 423
424 return [self shouldShowMenubarInImmersiveFullscreen] 424 return [self shouldShowMenubarInImmersiveFullscreen]
425 ? -[self floatingBarVerticalOffset] 425 ? -[self floatingBarVerticalOffset]
426 : 0; 426 : 0;
427 } 427 }
428 428
429 - (BOOL)isFullscreenTransitionInProgress {
430 return [browserController_ isFullscreenTransitionInProgress];
431 }
432
429 - (BOOL)isMainWindow { 433 - (BOOL)isMainWindow {
430 return [browserController_ window].isMainWindow; 434 return [browserController_ window].isMainWindow;
431 } 435 }
432 436
433 // Used to activate the floating bar in presentation mode. 437 // Used to activate the floating bar in presentation mode.
434 - (void)mouseEntered:(NSEvent*)event { 438 - (void)mouseEntered:(NSEvent*)event {
435 DCHECK(inPresentationMode_); 439 DCHECK(inPresentationMode_);
436 440
437 // Having gotten a mouse entered, we no longer need to do exit checks. 441 // Having gotten a mouse entered, we no longer need to do exit checks.
438 [self cancelMouseExitCheck]; 442 [self cancelMouseExitCheck];
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 [self updateMenuBarAndDockVisibility]; 756 [self updateMenuBarAndDockVisibility];
753 757
754 // TODO(rohitrao): Remove the Exit Fullscreen button. http://crbug.com/35956 758 // TODO(rohitrao): Remove the Exit Fullscreen button. http://crbug.com/35956
755 } 759 }
756 760
757 - (BOOL)shouldShowMenubarInImmersiveFullscreen { 761 - (BOOL)shouldShowMenubarInImmersiveFullscreen {
758 return [self doesScreenHaveMenuBar] && toolbarFraction_ > 0.99; 762 return [self doesScreenHaveMenuBar] && toolbarFraction_ > 0.99;
759 } 763 }
760 764
761 @end 765 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/presentation_mode_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698