| 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 | |
| 112 // Starts a timer which will close the bubble if |auto_close_| is true. | 106 // Starts a timer which will close the bubble if |auto_close_| is true. |
| 113 void StartTimerIfNecessary(); | 107 void StartTimerIfNecessary(); |
| 114 | 108 |
| 115 // Stops the auto-close timer. | 109 // Stops the auto-close timer. |
| 116 void StopTimer(); | 110 void StopTimer(); |
| 117 | 111 |
| 118 ZoomBubbleExtensionInfo extension_info_; | 112 ZoomBubbleExtensionInfo extension_info_; |
| 119 | 113 |
| 120 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on | 114 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on |
| 121 // the active browser window, so there is no case in which it will be shown | 115 // the active browser window, so there is no case in which it will be shown |
| 122 // twice at the same time. | 116 // twice at the same time. |
| 123 static ZoomBubbleView* zoom_bubble_; | 117 static ZoomBubbleView* zoom_bubble_; |
| 124 | 118 |
| 125 // Timer used to auto close the bubble. | 119 // Timer used to auto close the bubble. |
| 126 base::OneShotTimer timer_; | 120 base::OneShotTimer timer_; |
| 127 | 121 |
| 128 // Timer duration that is made longer if a user presses + or - buttons. | |
| 129 base::TimeDelta auto_close_duration_; | |
| 130 | |
| 131 // Image button in the zoom bubble that will show the |extension_icon_| image | 122 // Image button in the zoom bubble that will show the |extension_icon_| image |
| 132 // if an extension initiated the zoom change, and links to that extension at | 123 // if an extension initiated the zoom change, and links to that extension at |
| 133 // "chrome://extensions". | 124 // "chrome://extensions". |
| 134 views::ImageButton* image_button_; | 125 views::ImageButton* image_button_; |
| 135 | 126 |
| 136 // Label displaying the zoom percentage. | 127 // Label displaying the zoom percentage. |
| 137 views::Label* label_; | 128 views::Label* label_; |
| 138 | 129 |
| 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 | |
| 144 // The WebContents for the page whose zoom has changed. | 130 // The WebContents for the page whose zoom has changed. |
| 145 content::WebContents* web_contents_; | 131 content::WebContents* web_contents_; |
| 146 | 132 |
| 147 // Whether the currently displayed bubble will automatically close. | 133 // Whether the currently displayed bubble will automatically close. |
| 148 bool auto_close_; | 134 bool auto_close_; |
| 149 | 135 |
| 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 | |
| 155 // The immersive mode controller for the BrowserView containing | 136 // The immersive mode controller for the BrowserView containing |
| 156 // |web_contents_|. | 137 // |web_contents_|. |
| 157 // Not owned. | 138 // Not owned. |
| 158 ImmersiveModeController* immersive_mode_controller_; | 139 ImmersiveModeController* immersive_mode_controller_; |
| 159 | 140 |
| 160 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); | 141 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
| 161 }; | 142 }; |
| 162 | 143 |
| 163 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ | 144 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
| OLD | NEW |