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

Side by Side Diff: chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_animation_manager.h

Issue 2355413007: [Mac] Refactor the Fullscreen Toolbar (Closed)
Patch Set: Nits and grits Created 4 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_FULLSCREEN_TOOLBAR_ANIMATION_MANAGER_ H_
6 #define CHROME_BROWSER_UI_COCOA_FULLSCREEN_FULLSCREEN_TOOLBAR_ANIMATION_MANAGER_ H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "base/mac/mac_util.h"
11 #include "base/macros.h"
12 #include "base/timer/timer.h"
13 #include "ui/gfx/animation/animation_delegate.h"
14 #include "ui/gfx/animation/slide_animation.h"
15
16 namespace {
17 class FullscreenToolbarLayoutTest;
18 }
19
20 class FullscreenToolbarLayoutManager;
21
22 class FullscreenToolbarAnimationManager : public gfx::AnimationDelegate {
23 public:
24 FullscreenToolbarAnimationManager(FullscreenToolbarLayoutManager* owner);
25
26 // Called by |owner_| to update the current toolbar fraction.
27 void UpdateToolbarFraction(CGFloat fraction);
28
29 // Stops the animation and cancels |hide_toolbar_timer_|.
30 void StopAnimationAndTimer();
31
32 // Animates the toolbar in and out to show changes with the tabstrip.
33 void AnimateToolbarForTabstripChanges();
34
35 // Animates the toolbar in if it's not fully shown.
36 void AnimateToolbarIn();
37
38 // Animates the toolbar out if it's not focused.
39 void AnimateToolbarOutIfPossible();
40
41 // Returns the toolbar fraction calculated from the animation progress.
42 CGFloat GetToolbarFraction() const;
43
44 // Returns true if |animation_| is running.
45 BOOL IsAnimationRunning() const;
46
47 // gfx::AnimationDelegate:
48 void AnimationProgressed(const gfx::Animation* animation) override;
49 void AnimationEnded(const gfx::Animation* animation) override;
50
51 private:
52 friend class ::FullscreenToolbarLayoutTest;
53
54 // Our owner.
55 FullscreenToolbarLayoutManager* owner_; // weak
56
57 // The animation of the decoration.
58 gfx::SlideAnimation animation_;
59
60 // Timer that will start the scrollbar's hiding animation when it reaches 0.
61 base::Timer hide_toolbar_timer_;
62
63 // The current fraction of the toolbar being displayed. Used as the starting
64 // point of the animation.
65 CGFloat toolbar_fraction_;
66
67 // True when the toolbar is dropped to show tabstrip changes.
68 BOOL should_hide_toolbar_after_delay_;
69
70 // Used to disable find bar animations when testing.
71 BOOL disable_animations_during_testing_;
72 };
73
74 #endif // CHROME_BROWSER_UI_COCOA_FULLSCREEN_FULLSCREEN_TOOLBAR_ANIMATION_MANAG ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698