OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/timer.h" |
| 11 #include "ui/views/bubble/bubble_delegate.h" |
| 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/label.h" |
| 14 |
| 15 // View used to display the zoom percentage when it has changed. |
| 16 class ZoomBubbleView : public views::BubbleDelegateView { |
| 17 public: |
| 18 // Shows the bubble and automatically closes it after a short time period if |
| 19 // |auto_close| is true. |
| 20 static void ShowBubble(views::View* anchor_view, |
| 21 int zoom_percent, |
| 22 bool auto_close); |
| 23 static void CloseBubble(); |
| 24 static bool IsShowing(); |
| 25 |
| 26 private: |
| 27 ZoomBubbleView(views::View* anchor_view, |
| 28 int zoom_percent, |
| 29 bool auto_close); |
| 30 virtual ~ZoomBubbleView(); |
| 31 |
| 32 void Close(); |
| 33 |
| 34 // views::BubbleDelegateView method. |
| 35 virtual void Init() OVERRIDE; |
| 36 |
| 37 // views::BubbleDelegateView: |
| 38 virtual void WindowClosing() OVERRIDE; |
| 39 |
| 40 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on |
| 41 // the active browser window, so there is no case in which it will be shown |
| 42 // twice at the same time. |
| 43 static ZoomBubbleView* zoom_bubble_; |
| 44 |
| 45 // Timer used to close the bubble when |auto_close_| is true. |
| 46 base::OneShotTimer<ZoomBubbleView> timer_; |
| 47 |
| 48 // Label displaying the zoom percentage. |
| 49 views::Label* label_; |
| 50 |
| 51 // The zoom percentage to show in the bubble. |
| 52 int zoom_percent_; |
| 53 |
| 54 // Whether the currently displayed bubble will automatically close. |
| 55 bool auto_close_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
OLD | NEW |