OLD | NEW |
---|---|
(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_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/macros.h" | |
12 #include "base/timer/timer.h" | |
13 #include "ui/gfx/animation/animation_delegate.h" | |
14 | |
15 class ExclusiveAccessBubbleViewsContext; | |
16 class SubtleNotificationView; | |
17 | |
18 namespace gfx { | |
19 class Animation; | |
20 class Rect; | |
21 class SlideAnimation; | |
22 } | |
23 | |
24 namespace views { | |
25 class View; | |
26 class Widget; | |
27 } | |
28 | |
29 // BackspaceNewShortcutBubble shows a short-lived notification along the top of | |
30 // the screen when the user presses the old Back/Forward shortcut, telling them | |
31 // how to use the new shortcut. This will only be available for a few milestones | |
32 // to let users adapt. | |
33 // TODO(mgiuca): Remove this in M54 (https://crbug.com/610039). | |
34 class BackspaceNewShortcutBubble : public gfx::AnimationDelegate { | |
Peter Kasting
2016/05/19 10:08:37
Can any of this class be combined with/factored ou
Matt Giuca
2016/05/23 04:22:57
Probably a little bit (setting up / tearing down t
| |
35 public: | |
36 BackspaceNewShortcutBubble(ExclusiveAccessBubbleViewsContext* context, | |
37 bool forward); | |
38 ~BackspaceNewShortcutBubble() override; | |
39 | |
40 void UpdateContent(bool forward); | |
41 | |
42 private: | |
43 // Updates |popup|'s bounds given |animation_| and |animated_attribute_|. | |
Peter Kasting
2016/05/19 10:08:36
Nit: popup -> popup_ ; there is no member animated
Matt Giuca
2016/05/23 04:22:57
Gone.
| |
44 void UpdateBounds(); | |
45 | |
46 void UpdateViewContent(bool forward); | |
47 | |
48 // Returns the root view containing |browser_view_|. | |
49 views::View* GetBrowserRootView() const; | |
Peter Kasting
2016/05/19 10:08:36
Nit: Const functions should not return non-const p
Matt Giuca
2016/05/23 04:22:57
Gone.
| |
50 | |
51 // gfx::AnimationDelegate overrides: | |
Peter Kasting
2016/05/19 10:08:37
Nit: Place overrides above or below all non-overri
Matt Giuca
2016/05/23 04:22:57
Done.
| |
52 void AnimationProgressed(const gfx::Animation* animation) override; | |
53 void AnimationEnded(const gfx::Animation* animation) override; | |
54 | |
55 gfx::Rect GetPopupRect(bool ignore_animation_state) const; | |
56 void Hide(); | |
57 void Show(); | |
58 void TimerElapsed(); | |
Peter Kasting
2016/05/19 10:08:37
Nit: OnTimerElapsed()?
Matt Giuca
2016/05/23 04:22:57
Done.
| |
59 | |
60 ExclusiveAccessBubbleViewsContext* const bubble_view_context_; | |
61 | |
62 views::Widget* popup_; | |
63 | |
64 // Animation controlling showing/hiding of the exit bubble. | |
Peter Kasting
2016/05/19 10:08:37
Nit: This isn't an "exit" bubble.
Matt Giuca
2016/05/23 04:22:57
Done.
| |
65 std::unique_ptr<gfx::SlideAnimation> animation_; | |
66 | |
67 // Timer before the bubble disappears. | |
68 base::OneShotTimer hide_timeout_; | |
69 | |
70 // The contents of the popup. | |
71 SubtleNotificationView* view_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(BackspaceNewShortcutBubble); | |
74 }; | |
75 | |
76 #endif // CHROME_BROWSER_UI_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ | |
OLD | NEW |