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

Side by Side Diff: chrome/browser/ui/views/location_bar/zoom_bubble_view.h

Issue 10792020: Implements the "Set to default" button on the zoom bubble. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated a comment. Created 8 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/timer.h" 9 #include "base/timer.h"
10 #include "ui/views/bubble/bubble_delegate.h" 10 #include "ui/views/bubble/bubble_delegate.h"
11 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/label.h" 12 #include "ui/views/controls/label.h"
13 13
14 class TabContents;
15
14 // View used to display the zoom percentage when it has changed. 16 // View used to display the zoom percentage when it has changed.
15 class ZoomBubbleView : public views::BubbleDelegateView { 17 class ZoomBubbleView : public views::ButtonListener,
18 public views::BubbleDelegateView {
16 public: 19 public:
17 // Shows the bubble and automatically closes it after a short time period if 20 // Shows the bubble and automatically closes it after a short time period if
18 // |auto_close| is true. 21 // |auto_close| is true.
19 static void ShowBubble(views::View* anchor_view, 22 static void ShowBubble(views::View* anchor_view,
20 int zoom_percent, 23 TabContents* tab_contents,
21 bool auto_close); 24 bool auto_close);
22 static void CloseBubble(); 25 static void CloseBubble();
23 static bool IsShowing(); 26 static bool IsShowing();
24 27
25 private: 28 private:
26 ZoomBubbleView(views::View* anchor_view, 29 ZoomBubbleView(views::View* anchor_view,
27 int zoom_percent, 30 TabContents* tab_contents,
28 bool auto_close); 31 bool auto_close);
29 virtual ~ZoomBubbleView(); 32 virtual ~ZoomBubbleView();
30 33
34 // Refreshes the bubble by changing the zoom percentage appropriately and
35 // resetting the timer if necessary.
36 void Refresh();
37
38 // ButtonListener method.
tfarina 2012/07/17 05:57:56 nit: views::ButtonListener
Kyle Horimoto 2012/07/17 18:26:23 Done.
39 virtual void ButtonPressed(views::Button* sender,
tfarina 2012/07/17 05:57:56 can you move this declaration right after the Clos
Kyle Horimoto 2012/07/17 18:26:23 Done.
40 const views::Event& event) OVERRIDE;
41
31 void Close(); 42 void Close();
32 43
33 // views::BubbleDelegateView method. 44 // views::BubbleDelegateView method.
34 virtual void Init() OVERRIDE; 45 virtual void Init() OVERRIDE;
35 46
36 // views::BubbleDelegateView: 47 // views::BubbleDelegateView method.
37 virtual void WindowClosing() OVERRIDE; 48 virtual void WindowClosing() OVERRIDE;
38 49
39 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on 50 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on
40 // the active browser window, so there is no case in which it will be shown 51 // the active browser window, so there is no case in which it will be shown
41 // twice at the same time. 52 // twice at the same time.
42 static ZoomBubbleView* zoom_bubble_; 53 static ZoomBubbleView* zoom_bubble_;
43 54
44 // Timer used to close the bubble when |auto_close_| is true. 55 // Timer used to close the bubble when |auto_close_| is true.
45 base::OneShotTimer<ZoomBubbleView> timer_; 56 base::OneShotTimer<ZoomBubbleView> timer_;
46 57
47 // Label displaying the zoom percentage. 58 // Label displaying the zoom percentage.
48 views::Label* label_; 59 views::Label* label_;
49 60
50 // The zoom percentage to show in the bubble. 61 // The TabContents for the page whose zoom has changed.
51 int zoom_percent_; 62 TabContents* tab_contents_;
52 63
53 // Whether the currently displayed bubble will automatically close. 64 // Whether the currently displayed bubble will automatically close.
54 bool auto_close_; 65 bool auto_close_;
55 66
56 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); 67 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView);
57 }; 68 };
58 69
59 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ 70 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/browser/ui/views/location_bar/zoom_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698