Index: chrome/browser/ui/views/new_back_shortcut_bubble.h |
diff --git a/chrome/browser/ui/views/new_back_shortcut_bubble.h b/chrome/browser/ui/views/new_back_shortcut_bubble.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..38b2e9917ebc23d7f13ab0f037ce012240e159c1 |
--- /dev/null |
+++ b/chrome/browser/ui/views/new_back_shortcut_bubble.h |
@@ -0,0 +1,66 @@ |
+// 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_NEW_BACK_SHORTCUT_BUBBLE_H_ |
+#define CHROME_BROWSER_UI_VIEWS_NEW_BACK_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; |
+} |
+ |
+// NewBackShortcutBubble 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 NewBackShortcutBubble : public gfx::AnimationDelegate { |
+ public: |
+ NewBackShortcutBubble(ExclusiveAccessBubbleViewsContext* context, |
+ bool forward); |
+ ~NewBackShortcutBubble() override; |
+ |
+ void UpdateContent(bool forward); |
+ |
+ private: |
+ // gfx::AnimationDelegate: |
+ void AnimationProgressed(const gfx::Animation* animation) override; |
+ void AnimationEnded(const gfx::Animation* animation) override; |
+ |
+ gfx::Rect GetPopupRect(bool ignore_animation_state) const; |
+ void OnTimerElapsed(); |
+ |
+ ExclusiveAccessBubbleViewsContext* const bubble_view_context_; |
+ |
+ // Animation controlling showing/hiding of the bubble. |
+ std::unique_ptr<gfx::SlideAnimation> animation_; |
+ |
+ // Timer before the bubble disappears. |
+ base::OneShotTimer hide_timeout_; |
+ |
+ // The contents of the popup. |
+ SubtleNotificationView* const view_; |
+ |
+ views::Widget* const popup_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(NewBackShortcutBubble); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_NEW_BACK_SHORTCUT_BUBBLE_H_ |