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

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

Issue 2845593002: Updates Zoom bubble layout and adds +/- buttons (Closed)
Patch Set: Updates Zoom bubble layout and adds +/- buttons (comments) Created 3 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 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/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 11 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
12 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h" 12 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "extensions/browser/extension_icon_image.h" 15 #include "extensions/browser/extension_icon_image.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
18 18
19 namespace content { 19 namespace content {
20 class WebContents; 20 class WebContents;
21 } 21 }
22 22
23 namespace gfx {
24 struct VectorIcon;
25 }
26
23 namespace views { 27 namespace views {
24 class ImageButton; 28 class ImageButton;
25 } // namespace views 29 } // namespace views
26 30
27 // View used to display the zoom percentage when it has changed. 31 // View used to display the zoom percentage when it has changed.
28 class ZoomBubbleView : public LocationBarBubbleDelegateView, 32 class ZoomBubbleView : public LocationBarBubbleDelegateView,
29 public views::ButtonListener, 33 public views::ButtonListener,
30 public ImmersiveModeController::Observer, 34 public ImmersiveModeController::Observer,
31 public extensions::IconImage::Observer { 35 public extensions::IconImage::Observer {
32 public: 36 public:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 void OnImmersiveModeControllerDestroyed() override; 100 void OnImmersiveModeControllerDestroyed() override;
97 101
98 // extensions::IconImage::Observer: 102 // extensions::IconImage::Observer:
99 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; 103 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override;
100 104
101 // Sets information about the extension that initiated the zoom change. 105 // Sets information about the extension that initiated the zoom change.
102 // Calling this method asserts that the extension |extension| did initiate 106 // Calling this method asserts that the extension |extension| did initiate
103 // the zoom change. 107 // the zoom change.
104 void SetExtensionInfo(const extensions::Extension* extension); 108 void SetExtensionInfo(const extensions::Extension* extension);
105 109
110 // Creates an ImageButton using vector |icon|, sets a tooltip with
111 // |tooltip_id|. Returns the button.
112 views::Button* CreateZoomButton(const gfx::VectorIcon& icon, int tooltip_id);
113
114 // Updates |label_| with the up to date zoom.
115 void UpdateZoomPercent();
116
106 // Starts a timer which will close the bubble if |auto_close_| is true. 117 // Starts a timer which will close the bubble if |auto_close_| is true.
107 void StartTimerIfNecessary(); 118 void StartTimerIfNecessary();
108 119
109 // Stops the auto-close timer. 120 // Stops the auto-close timer.
110 void StopTimer(); 121 void StopTimer();
111 122
112 ZoomBubbleExtensionInfo extension_info_; 123 ZoomBubbleExtensionInfo extension_info_;
113 124
114 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on 125 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on
115 // the active browser window, so there is no case in which it will be shown 126 // the active browser window, so there is no case in which it will be shown
116 // twice at the same time. 127 // twice at the same time.
117 static ZoomBubbleView* zoom_bubble_; 128 static ZoomBubbleView* zoom_bubble_;
118 129
119 // Timer used to auto close the bubble. 130 // Timer used to auto close the bubble.
120 base::OneShotTimer timer_; 131 base::OneShotTimer timer_;
121 132
122 // Image button in the zoom bubble that will show the |extension_icon_| image 133 // Image button in the zoom bubble that will show the |extension_icon_| image
123 // if an extension initiated the zoom change, and links to that extension at 134 // if an extension initiated the zoom change, and links to that extension at
124 // "chrome://extensions". 135 // "chrome://extensions".
125 views::ImageButton* image_button_; 136 views::ImageButton* image_button_;
126 137
127 // Label displaying the zoom percentage. 138 // Label displaying the zoom percentage.
128 views::Label* label_; 139 views::Label* label_;
129 140
141 // Action buttons that can change zoom.
142 views::Button* zoom_out_button_;
143 views::Button* zoom_in_button_;
144 views::Button* reset_button_;
145
130 // The WebContents for the page whose zoom has changed. 146 // The WebContents for the page whose zoom has changed.
131 content::WebContents* web_contents_; 147 content::WebContents* web_contents_;
132 148
133 // Whether the currently displayed bubble will automatically close. 149 // Whether the currently displayed bubble will automatically close.
134 bool auto_close_; 150 bool auto_close_;
135 151
152 // True when handling a button click event.
153 bool ignore_close_bubble_;
154
136 // The immersive mode controller for the BrowserView containing 155 // The immersive mode controller for the BrowserView containing
137 // |web_contents_|. 156 // |web_contents_|.
138 // Not owned. 157 // Not owned.
139 ImmersiveModeController* immersive_mode_controller_; 158 ImmersiveModeController* immersive_mode_controller_;
140 159
141 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); 160 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView);
142 }; 161 };
143 162
144 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ 163 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698