OLD | NEW |
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" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void OnImmersiveModeControllerDestroyed() override; | 96 void OnImmersiveModeControllerDestroyed() override; |
97 | 97 |
98 // extensions::IconImage::Observer: | 98 // extensions::IconImage::Observer: |
99 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; | 99 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
100 | 100 |
101 // Sets information about the extension that initiated the zoom change. | 101 // Sets information about the extension that initiated the zoom change. |
102 // Calling this method asserts that the extension |extension| did initiate | 102 // Calling this method asserts that the extension |extension| did initiate |
103 // the zoom change. | 103 // the zoom change. |
104 void SetExtensionInfo(const extensions::Extension* extension); | 104 void SetExtensionInfo(const extensions::Extension* extension); |
105 | 105 |
| 106 // Updates |label_| with the up to date zoom. |
| 107 void UpdateZoomPercent(); |
| 108 |
| 109 // Updates visibility of the zoom icon in location bar. |
| 110 void UpdateZoomIconVisibility(); |
| 111 |
106 // Starts a timer which will close the bubble if |auto_close_| is true. | 112 // Starts a timer which will close the bubble if |auto_close_| is true. |
107 void StartTimerIfNecessary(); | 113 void StartTimerIfNecessary(); |
108 | 114 |
109 // Stops the auto-close timer. | 115 // Stops the auto-close timer. |
110 void StopTimer(); | 116 void StopTimer(); |
111 | 117 |
112 ZoomBubbleExtensionInfo extension_info_; | 118 ZoomBubbleExtensionInfo extension_info_; |
113 | 119 |
114 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on | 120 // 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 | 121 // the active browser window, so there is no case in which it will be shown |
116 // twice at the same time. | 122 // twice at the same time. |
117 static ZoomBubbleView* zoom_bubble_; | 123 static ZoomBubbleView* zoom_bubble_; |
118 | 124 |
119 // Timer used to auto close the bubble. | 125 // Timer used to auto close the bubble. |
120 base::OneShotTimer timer_; | 126 base::OneShotTimer timer_; |
121 | 127 |
| 128 // Timer duration that is made longer if a user presses + or - buttons. |
| 129 base::TimeDelta auto_close_duration_; |
| 130 |
122 // Image button in the zoom bubble that will show the |extension_icon_| image | 131 // 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 | 132 // if an extension initiated the zoom change, and links to that extension at |
124 // "chrome://extensions". | 133 // "chrome://extensions". |
125 views::ImageButton* image_button_; | 134 views::ImageButton* image_button_; |
126 | 135 |
127 // Label displaying the zoom percentage. | 136 // Label displaying the zoom percentage. |
128 views::Label* label_; | 137 views::Label* label_; |
129 | 138 |
| 139 // Action buttons that can change zoom. |
| 140 views::Button* zoom_out_button_; |
| 141 views::Button* zoom_in_button_; |
| 142 views::Button* reset_button_; |
| 143 |
130 // The WebContents for the page whose zoom has changed. | 144 // The WebContents for the page whose zoom has changed. |
131 content::WebContents* web_contents_; | 145 content::WebContents* web_contents_; |
132 | 146 |
133 // Whether the currently displayed bubble will automatically close. | 147 // Whether the currently displayed bubble will automatically close. |
134 bool auto_close_; | 148 bool auto_close_; |
135 | 149 |
| 150 // Used to ignore close requests generated automatically in response to |
| 151 // button presses, since pressing a button in the bubble should not trigger |
| 152 // closing. |
| 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_ |
OLD | NEW |