| 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 #include "chrome/browser/ui/views/location_bar/zoom_view.h" | 5 #include "chrome/browser/ui/views/location_bar/zoom_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 7 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 9 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 9 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 10 #include "chrome/browser/ui/zoom/zoom_controller.h" | 10 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ZoomView::Update(ZoomController* zoom_controller) { | 28 void ZoomView::Update(ZoomController* zoom_controller) { |
| 29 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || | 29 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() || |
| 30 location_bar_delegate_->GetToolbarModel()->input_in_progress()) { | 30 location_bar_delegate_->GetToolbarModel()->input_in_progress()) { |
| 31 SetVisible(false); | 31 SetVisible(false); |
| 32 ZoomBubbleView::CloseBubble(); | 32 ZoomBubbleView::CloseBubble(); |
| 33 return; | 33 return; |
| 34 } | 34 } |
| 35 | 35 |
| 36 SetTooltipText(l10n_util::GetStringFUTF16Int(IDS_TOOLTIP_ZOOM, | 36 SetTooltipText(l10n_util::GetStringFUTF16Int( |
| 37 zoom_controller->zoom_percent())); | 37 IDS_TOOLTIP_ZOOM, zoom_controller->GetZoomPercent())); |
| 38 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 38 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 39 zoom_controller->GetResourceForZoomLevel())); | 39 zoom_controller->GetResourceForZoomLevel())); |
| 40 SetVisible(true); | 40 SetVisible(true); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ZoomView::GetAccessibleState(ui::AXViewState* state) { | 43 void ZoomView::GetAccessibleState(ui::AXViewState* state) { |
| 44 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ZOOM); | 44 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ZOOM); |
| 45 state->role = ui::AX_ROLE_BUTTON; | 45 state->role = ui::AX_ROLE_BUTTON; |
| 46 } | 46 } |
| 47 | 47 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { | 74 void ZoomView::OnGestureEvent(ui::GestureEvent* event) { |
| 75 if (event->type() == ui::ET_GESTURE_TAP) { | 75 if (event->type() == ui::ET_GESTURE_TAP) { |
| 76 ActivateBubble(); | 76 ActivateBubble(); |
| 77 event->SetHandled(); | 77 event->SetHandled(); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ZoomView::ActivateBubble() { | 81 void ZoomView::ActivateBubble() { |
| 82 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); | 82 ZoomBubbleView::ShowBubble(location_bar_delegate_->GetWebContents(), false); |
| 83 } | 83 } |
| OLD | NEW |