Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/zoom_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/zoom_view.cc b/chrome/browser/ui/views/location_bar/zoom_view.cc |
| index 7912f89e7a1e21e593c290e50813310fcde3ffed..5f32a0cbb6fb3ba879f929752a1eb0a3ddba3766 100644 |
| --- a/chrome/browser/ui/views/location_bar/zoom_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/zoom_view.cc |
| @@ -15,44 +15,27 @@ |
| #include "ui/gfx/size.h" |
| ZoomView::ZoomView(ToolbarModel* toolbar_model) |
| - : toolbar_model_(toolbar_model), |
| - zoom_icon_state_(ZoomController::NONE), |
| - zoom_percent_(100) { |
| + : toolbar_model_(toolbar_model) { |
| set_accessibility_focusable(true); |
| + Update(NULL); |
| } |
| ZoomView::~ZoomView() { |
| } |
| -void ZoomView::SetZoomIconState(ZoomController::ZoomIconState zoom_icon_state) { |
| - if (zoom_icon_state == zoom_icon_state_) |
| - return; |
| - |
| - zoom_icon_state_ = zoom_icon_state; |
| - Update(); |
| -} |
| - |
| -void ZoomView::SetZoomIconTooltipPercent(int zoom_percent) { |
| - if (zoom_percent == zoom_percent_) |
| - return; |
| - |
| - zoom_percent_ = zoom_percent; |
| - Update(); |
| -} |
| - |
| -void ZoomView::Update() { |
| - if (toolbar_model_->input_in_progress() || |
| - zoom_icon_state_ == ZoomController::NONE) { |
| +void ZoomView::Update(ZoomController* zoom_controller) { |
| + if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || |
| + toolbar_model_->input_in_progress()) { |
| SetVisible(false); |
| - ZoomBubbleView::CloseBubble(); |
| - } else { |
| - SetVisible(true); |
| - SetTooltipText( |
| - l10n_util::GetStringFUTF16Int(IDS_TOOLTIP_ZOOM, zoom_percent_)); |
| - SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| - zoom_icon_state_ == ZoomController::ZOOM_PLUS_ICON ? |
| - IDR_ZOOM_PLUS : IDR_ZOOM_MINUS)); |
| + return; |
| } |
| + |
| + int zoom_percent = zoom_controller->zoom_percent(); |
| + SetTooltipText( |
| + l10n_util::GetStringFUTF16Int(IDS_TOOLTIP_ZOOM, zoom_percent)); |
| + SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| + zoom_percent > 100 ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS)); |
|
Kyle Horimoto
2012/07/24 03:22:28
Same thing with 100 vs. default zoom percent.
Dan Beam
2012/08/15 09:04:59
Done.
|
| + SetVisible(true); |
| } |
| void ZoomView::GetAccessibleState(ui::AccessibleViewState* state) { |
| @@ -64,22 +47,3 @@ bool ZoomView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { |
| // Don't show tooltip if the zoom bubble is displayed. |
| return !ZoomBubbleView::IsShowing() && ImageView::GetTooltipText(p, tooltip); |
| } |
| - |
| -bool ZoomView::OnMousePressed(const views::MouseEvent& event) { |
| - // Do nothing until mouse is released. |
| - return true; |
| -} |
| - |
| -void ZoomView::OnMouseReleased(const views::MouseEvent& event) { |
| - if (event.IsOnlyLeftMouseButton() && HitTest(event.location())) |
| - ZoomBubbleView::ShowBubble(this, zoom_percent_, false); |
| -} |
| - |
| -bool ZoomView::OnKeyPressed(const views::KeyEvent& event) { |
| - if (event.key_code() != ui::VKEY_SPACE && |
| - event.key_code() != ui::VKEY_RETURN) |
| - return false; |
| - |
| - ZoomBubbleView::ShowBubble(this, zoom_percent_, false); |
| - return true; |
| -} |