| OLD | NEW |
| 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_toolbar_visibility_lock_c
ontroller.h" | 5 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_c
ontroller.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 | 8 |
| 9 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_control
ler.h" | 9 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_control
ler.h" |
| 10 #import "chrome/browser/ui/cocoa/fullscreen_toolbar_controller.h" | 10 #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" |
| 11 | 11 |
| 12 @interface FullscreenToolbarVisibilityLockController () { | 12 @interface FullscreenToolbarVisibilityLockController () { |
| 13 // Stores the objects that are locking the toolbar visibility. | 13 // Stores the objects that are locking the toolbar visibility. |
| 14 base::scoped_nsobject<NSMutableSet> visibilityLocks_; | 14 base::scoped_nsobject<NSMutableSet> visibilityLocks_; |
| 15 | 15 |
| 16 // Our owner. | 16 // Our owner. |
| 17 FullscreenToolbarController* owner_; // weak | 17 FullscreenToolbarController* owner_; // weak |
| 18 | 18 |
| 19 // The object managing the fullscreen toolbar's animations. | 19 // The object managing the fullscreen toolbar's animations. |
| 20 FullscreenToolbarAnimationController* animationController_; // weak | 20 FullscreenToolbarAnimationController* animationController_; // weak |
| (...skipping 29 matching lines...) Expand all Loading... |
| 50 | 50 |
| 51 - (void)lockToolbarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { | 51 - (void)lockToolbarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { |
| 52 if ([self isToolbarVisibilityLockedForOwner:owner]) | 52 if ([self isToolbarVisibilityLockedForOwner:owner]) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 [visibilityLocks_ addObject:owner]; | 55 [visibilityLocks_ addObject:owner]; |
| 56 | 56 |
| 57 if (animate) | 57 if (animate) |
| 58 animationController_->AnimateToolbarIn(); | 58 animationController_->AnimateToolbarIn(); |
| 59 else | 59 else |
| 60 [owner_ updateToolbar]; | 60 [owner_ updateToolbarLayout]; |
| 61 } | 61 } |
| 62 | 62 |
| 63 - (void)releaseToolbarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { | 63 - (void)releaseToolbarVisibilityForOwner:(id)owner withAnimation:(BOOL)animate { |
| 64 if (![self isToolbarVisibilityLockedForOwner:owner]) | 64 if (![self isToolbarVisibilityLockedForOwner:owner]) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 [visibilityLocks_ removeObject:owner]; | 67 [visibilityLocks_ removeObject:owner]; |
| 68 | 68 |
| 69 if (animate) | 69 if (animate) |
| 70 animationController_->AnimateToolbarOutIfPossible(); | 70 animationController_->AnimateToolbarOutIfPossible(); |
| 71 else | 71 else |
| 72 [owner_ updateToolbar]; | 72 [owner_ updateToolbarLayout]; |
| 73 } | 73 } |
| 74 | 74 |
| 75 @end | 75 @end |
| OLD | NEW |