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

Unified Diff: chrome/browser/ui/views/backspace_new_shortcut_bubble.h

Issue 1983803002: Added notification when user presses backspace to use new shortcut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@subtle-notification-view-refactor
Patch Set: Use UTF-16 instead of many UTF-8 conversions. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698