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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 ImmersiveModeController* immersive_mode_controller); | 80 ImmersiveModeController* immersive_mode_controller); |
81 ~ZoomBubbleView() override; | 81 ~ZoomBubbleView() override; |
82 | 82 |
83 // LocationBarBubbleDelegateView: | 83 // LocationBarBubbleDelegateView: |
84 void OnGestureEvent(ui::GestureEvent* event) override; | 84 void OnGestureEvent(ui::GestureEvent* event) override; |
85 void OnMouseEntered(const ui::MouseEvent& event) override; | 85 void OnMouseEntered(const ui::MouseEvent& event) override; |
86 void OnMouseExited(const ui::MouseEvent& event) override; | 86 void OnMouseExited(const ui::MouseEvent& event) override; |
87 void Init() override; | 87 void Init() override; |
88 void WindowClosing() override; | 88 void WindowClosing() override; |
89 void CloseBubble() override; | 89 void CloseBubble() override; |
90 bool ShouldSnapFrameWidth() const override; | |
tapted
2017/05/16 06:29:02
since LocationBarBubbleDelegateView::GetDialogButt
varkha
2017/05/16 22:53:07
Done.
| |
90 | 91 |
91 // views::ButtonListener: | 92 // views::ButtonListener: |
92 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 93 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
93 | 94 |
94 // ImmersiveModeController::Observer: | 95 // ImmersiveModeController::Observer: |
95 void OnImmersiveRevealStarted() override; | 96 void OnImmersiveRevealStarted() override; |
96 void OnImmersiveModeControllerDestroyed() override; | 97 void OnImmersiveModeControllerDestroyed() override; |
97 | 98 |
98 // extensions::IconImage::Observer: | 99 // extensions::IconImage::Observer: |
99 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; | 100 void OnExtensionIconImageChanged(extensions::IconImage* /* image */) override; |
100 | 101 |
101 // Sets information about the extension that initiated the zoom change. | 102 // Sets information about the extension that initiated the zoom change. |
102 // Calling this method asserts that the extension |extension| did initiate | 103 // Calling this method asserts that the extension |extension| did initiate |
103 // the zoom change. | 104 // the zoom change. |
104 void SetExtensionInfo(const extensions::Extension* extension); | 105 void SetExtensionInfo(const extensions::Extension* extension); |
105 | 106 |
107 // Updates |label_| with the up to date zoom. | |
108 void UpdateZoomPercent(); | |
109 | |
106 // Starts a timer which will close the bubble if |auto_close_| is true. | 110 // Starts a timer which will close the bubble if |auto_close_| is true. |
107 void StartTimerIfNecessary(); | 111 void StartTimerIfNecessary(); |
108 | 112 |
109 // Stops the auto-close timer. | 113 // Stops the auto-close timer. |
110 void StopTimer(); | 114 void StopTimer(); |
111 | 115 |
112 ZoomBubbleExtensionInfo extension_info_; | 116 ZoomBubbleExtensionInfo extension_info_; |
113 | 117 |
114 // Singleton instance of the zoom bubble. The zoom bubble can only be shown on | 118 // 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 | 119 // the active browser window, so there is no case in which it will be shown |
116 // twice at the same time. | 120 // twice at the same time. |
117 static ZoomBubbleView* zoom_bubble_; | 121 static ZoomBubbleView* zoom_bubble_; |
118 | 122 |
119 // Timer used to auto close the bubble. | 123 // Timer used to auto close the bubble. |
120 base::OneShotTimer timer_; | 124 base::OneShotTimer timer_; |
121 | 125 |
126 // Timer duration that is made longer if a user presses + or - buttons. | |
127 base::TimeDelta auto_close_duration_; | |
128 | |
122 // Image button in the zoom bubble that will show the |extension_icon_| image | 129 // 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 | 130 // if an extension initiated the zoom change, and links to that extension at |
124 // "chrome://extensions". | 131 // "chrome://extensions". |
125 views::ImageButton* image_button_; | 132 views::ImageButton* image_button_; |
126 | 133 |
127 // Label displaying the zoom percentage. | 134 // Label displaying the zoom percentage. |
128 views::Label* label_; | 135 views::Label* label_; |
129 | 136 |
137 // Action buttons that can change zoom. | |
138 views::Button* zoom_out_button_; | |
139 views::Button* zoom_in_button_; | |
140 views::Button* reset_button_; | |
141 | |
130 // The WebContents for the page whose zoom has changed. | 142 // The WebContents for the page whose zoom has changed. |
131 content::WebContents* web_contents_; | 143 content::WebContents* web_contents_; |
132 | 144 |
133 // Whether the currently displayed bubble will automatically close. | 145 // Whether the currently displayed bubble will automatically close. |
134 bool auto_close_; | 146 bool auto_close_; |
135 | 147 |
148 // Used to ignore close requests generated automatically in response to | |
149 // button presses, since pressing a button in the bubble should not trigger | |
150 // closing. | |
151 bool ignore_close_bubble_; | |
152 | |
136 // The immersive mode controller for the BrowserView containing | 153 // The immersive mode controller for the BrowserView containing |
137 // |web_contents_|. | 154 // |web_contents_|. |
138 // Not owned. | 155 // Not owned. |
139 ImmersiveModeController* immersive_mode_controller_; | 156 ImmersiveModeController* immersive_mode_controller_; |
140 | 157 |
141 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); | 158 DISALLOW_COPY_AND_ASSIGN(ZoomBubbleView); |
142 }; | 159 }; |
143 | 160 |
144 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ | 161 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_BUBBLE_VIEW_H_ |
OLD | NEW |