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

Side by Side Diff: chrome/browser/ui/views/new_back_shortcut_bubble.h

Issue 2041293002: Add heuristics to limit showing of new backspace UI bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 6 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
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/new_back_shortcut_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698