Index: chrome/browser/ui/views/backspace_new_shortcut_bubble.h |
diff --git a/chrome/browser/ui/views/backspace_new_shortcut_bubble.h b/chrome/browser/ui/views/backspace_new_shortcut_bubble.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7c8303e42bdeba5570b3aca8dbe0b73f9d3749c2 |
--- /dev/null |
+++ b/chrome/browser/ui/views/backspace_new_shortcut_bubble.h |
@@ -0,0 +1,76 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ |
+#define CHROME_BROWSER_UI_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ |
+ |
+#include <memory> |
+ |
+#include "base/compiler_specific.h" |
+#include "base/macros.h" |
+#include "base/timer/timer.h" |
+#include "ui/gfx/animation/animation_delegate.h" |
+ |
+class ExclusiveAccessBubbleViewsContext; |
+class SubtleNotificationView; |
+ |
+namespace gfx { |
+class Animation; |
+class Rect; |
+class SlideAnimation; |
+} |
+ |
+namespace views { |
+class View; |
+class Widget; |
+} |
+ |
+// BackspaceNewShortcutBubble shows a short-lived notification along the top of |
+// the screen when the user presses the old Back/Forward shortcut, telling them |
+// how to use the new shortcut. This will only be available for a few milestones |
+// to let users adapt. |
+// TODO(mgiuca): Remove this in M54 (https://crbug.com/610039). |
+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
|
+ public: |
+ BackspaceNewShortcutBubble(ExclusiveAccessBubbleViewsContext* context, |
+ bool forward); |
+ ~BackspaceNewShortcutBubble() override; |
+ |
+ void UpdateContent(bool forward); |
+ |
+ private: |
+ // 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.
|
+ void UpdateBounds(); |
+ |
+ void UpdateViewContent(bool forward); |
+ |
+ // Returns the root view containing |browser_view_|. |
+ 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.
|
+ |
+ // 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.
|
+ void AnimationProgressed(const gfx::Animation* animation) override; |
+ void AnimationEnded(const gfx::Animation* animation) override; |
+ |
+ gfx::Rect GetPopupRect(bool ignore_animation_state) const; |
+ void Hide(); |
+ void Show(); |
+ void TimerElapsed(); |
Peter Kasting
2016/05/19 10:08:37
Nit: OnTimerElapsed()?
Matt Giuca
2016/05/23 04:22:57
Done.
|
+ |
+ ExclusiveAccessBubbleViewsContext* const bubble_view_context_; |
+ |
+ views::Widget* popup_; |
+ |
+ // 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.
|
+ std::unique_ptr<gfx::SlideAnimation> animation_; |
+ |
+ // Timer before the bubble disappears. |
+ base::OneShotTimer hide_timeout_; |
+ |
+ // The contents of the popup. |
+ SubtleNotificationView* view_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BackspaceNewShortcutBubble); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_BACKSPACE_NEW_SHORTCUT_BUBBLE_H_ |