| 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 #ifndef CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class Widget; | 26 class Widget; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // NewBackShortcutBubble shows a short-lived notification along the top of the | 29 // NewBackShortcutBubble shows a short-lived notification along the top of the |
| 30 // screen when the user presses the old Back/Forward shortcut, telling them how | 30 // screen when the user presses the old Back/Forward shortcut, telling them how |
| 31 // to use the new shortcut. This will only be available for a few milestones to | 31 // to use the new shortcut. This will only be available for a few milestones to |
| 32 // let users adapt. | 32 // let users adapt. |
| 33 // TODO(mgiuca): Remove this in M54 (https://crbug.com/610039). | 33 // TODO(mgiuca): Remove this in M54 (https://crbug.com/610039). |
| 34 class NewBackShortcutBubble : public gfx::AnimationDelegate { | 34 class NewBackShortcutBubble : public gfx::AnimationDelegate { |
| 35 public: | 35 public: |
| 36 NewBackShortcutBubble(ExclusiveAccessBubbleViewsContext* context, | 36 explicit NewBackShortcutBubble(ExclusiveAccessBubbleViewsContext* context); |
| 37 bool forward); | |
| 38 ~NewBackShortcutBubble() override; | 37 ~NewBackShortcutBubble() override; |
| 39 | 38 |
| 39 // Returns whether the UI is currently visible. |
| 40 bool IsVisible() const; |
| 41 |
| 42 // Ensures the UI is displaying the correct shortcut for forward/back based on |
| 43 // |forward|, and resets the hide timer. |
| 40 void UpdateContent(bool forward); | 44 void UpdateContent(bool forward); |
| 41 | 45 |
| 46 // Fades out the UI immediately. |
| 47 void Hide(); |
| 48 |
| 42 private: | 49 private: |
| 43 // gfx::AnimationDelegate: | 50 // gfx::AnimationDelegate: |
| 44 void AnimationProgressed(const gfx::Animation* animation) override; | 51 void AnimationProgressed(const gfx::Animation* animation) override; |
| 45 void AnimationEnded(const gfx::Animation* animation) override; | 52 void AnimationEnded(const gfx::Animation* animation) override; |
| 46 | 53 |
| 47 gfx::Rect GetPopupRect(bool ignore_animation_state) const; | 54 gfx::Rect GetPopupRect(bool ignore_animation_state) const; |
| 48 void OnTimerElapsed(); | 55 void OnTimerElapsed(); |
| 49 | 56 |
| 50 ExclusiveAccessBubbleViewsContext* const bubble_view_context_; | 57 ExclusiveAccessBubbleViewsContext* const bubble_view_context_; |
| 51 | 58 |
| 52 // Animation controlling showing/hiding of the bubble. | 59 // Animation controlling showing/hiding of the bubble. |
| 53 std::unique_ptr<gfx::SlideAnimation> animation_; | 60 std::unique_ptr<gfx::SlideAnimation> animation_; |
| 54 | 61 |
| 55 // Timer before the bubble disappears. | 62 // Timer before the bubble disappears. |
| 56 base::OneShotTimer hide_timeout_; | 63 base::OneShotTimer hide_timeout_; |
| 57 | 64 |
| 58 // The contents of the popup. | 65 // The contents of the popup. |
| 59 SubtleNotificationView* const view_; | 66 SubtleNotificationView* const view_; |
| 60 | 67 |
| 61 views::Widget* const popup_; | 68 views::Widget* const popup_; |
| 62 | 69 |
| 63 DISALLOW_COPY_AND_ASSIGN(NewBackShortcutBubble); | 70 DISALLOW_COPY_AND_ASSIGN(NewBackShortcutBubble); |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 #endif // CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ |
| OLD | NEW |