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

Side by Side Diff: chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm

Issue 2875673004: [Mac] Fullscreen Toolbar Fixes (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_mouse_tracker.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/fullscreen/fullscreen_menubar_tracker.h" 5 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 if (ui::IsCGFloatEqual(progress, 1.0)) 132 if (ui::IsCGFloatEqual(progress, 1.0))
133 state_ = FullscreenMenubarState::SHOWN; 133 state_ = FullscreenMenubarState::SHOWN;
134 else if (ui::IsCGFloatEqual(progress, 0.0)) 134 else if (ui::IsCGFloatEqual(progress, 0.0))
135 state_ = FullscreenMenubarState::HIDDEN; 135 state_ = FullscreenMenubarState::HIDDEN;
136 else if (progress < menubarFraction_) 136 else if (progress < menubarFraction_)
137 state_ = FullscreenMenubarState::HIDING; 137 state_ = FullscreenMenubarState::HIDING;
138 else if (progress > menubarFraction_) 138 else if (progress > menubarFraction_)
139 state_ = FullscreenMenubarState::SHOWING; 139 state_ = FullscreenMenubarState::SHOWING;
140 140
141 menubarFraction_ = progress;
142 [owner_ updateToolbarLayout];
143
141 // In 10.12. the toolbar to be janky since the UI doesn't update until the 144 // In 10.12. the toolbar to be janky since the UI doesn't update until the
142 // menubar finished revealing itself. To smooth things out, animate the 145 // menubar finished revealing itself. To smooth things out, animate the
143 // toolbar in/out by locking/releasing its visibility instead of relying on 146 // toolbar in/out by locking/releasing its visibility instead of relying on
144 // the menubar fraction. 147 // the menubar fraction.
145 // TODO(spqchan): Figure out why it's not updating and make the toolbar drop 148 // TODO(spqchan): Figure out why it's not updating and make the toolbar drop
146 // down in sync with the menubar. See crbug.com/672254. 149 // down in sync with the menubar. See crbug.com/672254.
147 if (base::mac::IsOS10_12()) { 150 if (base::mac::IsOS10_12()) {
148 if (state_ == FullscreenMenubarState::SHOWING) { 151 if (state_ == FullscreenMenubarState::SHOWING) {
149 [[owner_ visibilityLockController] lockToolbarVisibilityForOwner:self 152 [[owner_ visibilityLockController] lockToolbarVisibilityForOwner:self
150 withAnimation:YES]; 153 withAnimation:YES];
151 } else if (state_ == FullscreenMenubarState::HIDING) { 154 } else if (state_ == FullscreenMenubarState::HIDING) {
152 [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self 155 [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self
153 withAnimation:YES]; 156 withAnimation:YES];
154 } 157 }
155 } 158 }
156
157 menubarFraction_ = progress;
158 [owner_ updateToolbarLayout];
159 } 159 }
160 160
161 - (BOOL)isMouseOnScreen { 161 - (BOOL)isMouseOnScreen {
162 return NSMouseInRect([NSEvent mouseLocation], 162 return NSMouseInRect([NSEvent mouseLocation],
163 [[browserWindowController_ window] screen].frame, false); 163 [[browserWindowController_ window] screen].frame, false);
164 } 164 }
165 165
166 - (void)activeSpaceDidChange:(NSNotification*)notification { 166 - (void)activeSpaceDidChange:(NSNotification*)notification {
167 menubarFraction_ = 0.0; 167 menubarFraction_ = 0.0;
168 state_ = FullscreenMenubarState::HIDDEN; 168 state_ = FullscreenMenubarState::HIDDEN;
169 [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self 169 [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self
170 withAnimation:NO]; 170 withAnimation:NO];
171 [owner_ updateToolbarLayout]; 171 [owner_ updateToolbarLayout];
172 } 172 }
173 173
174 @end 174 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_mouse_tracker.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698