Chromium Code Reviews| Index: chrome/browser/ui/gtk/location_bar_view_gtk.cc |
| diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc |
| index 94a4bbf2ad9532c7ef956399f4e288021bc15758..e51893412f0cae424908ef22f286d78adb4ca3d7 100644 |
| --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc |
| +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc |
| @@ -494,7 +494,7 @@ GtkWidget* LocationBarViewGtk::GetPageActionWidget( |
| } |
| void LocationBarViewGtk::Update(const WebContents* contents) { |
| - UpdateZoomIcon(); |
| + UpdateZoomIcon(false); |
| UpdateStarIcon(); |
| UpdateChromeToMobileIcon(); |
| UpdateSiteTypeArea(); |
| @@ -920,7 +920,7 @@ void LocationBarViewGtk::Observe(int type, |
| 1, 1, 0, 0); |
| } |
| - UpdateZoomIcon(); |
| + UpdateZoomIcon(false); |
| UpdateStarIcon(); |
| UpdateChromeToMobileIcon(); |
| UpdateSiteTypeArea(); |
| @@ -1258,11 +1258,14 @@ gboolean LocationBarViewGtk::OnChromeToMobileButtonPress( |
| return FALSE; |
| } |
| -void LocationBarViewGtk::ShowZoomBubble(int zoom_percent) { |
| +void LocationBarViewGtk::ShowZoomBubble() { |
| if (!zoom_.get() || toolbar_model_->input_in_progress()) |
| return; |
| - ZoomBubbleGtk::Show(zoom_.get(), browser_->profile(), zoom_percent, true); |
| + const ZoomController* zc = |
| + TabContents::FromWebContents(GetWebContents())->zoom_controller(); |
|
Evan Stade
2012/07/13 05:31:00
why not GetTabContents?
Dan Beam
2012/07/24 03:00:49
Done.
|
| + ZoomBubbleGtk::Show( |
| + zoom_.get(), browser_->profile(), zc->zoom_percent(), true); |
| } |
| void LocationBarViewGtk::ShowStarBubble(const GURL& url, |
| @@ -1278,13 +1281,9 @@ void LocationBarViewGtk::ShowChromeToMobileBubble() { |
| ChromeToMobileBubbleGtk::Show(GTK_IMAGE(chrome_to_mobile_image_), browser_); |
| } |
| -void LocationBarViewGtk::SetZoomIconTooltipPercent(int zoom_percent) { |
| - UpdateZoomIcon(); |
| -} |
| - |
| -void LocationBarViewGtk::SetZoomIconState( |
| - ZoomController::ZoomIconState zoom_icon_state) { |
| - UpdateZoomIcon(); |
| +void LocationBarViewGtk::ZoomChangedForActiveTab(TabContents* tab_contents, |
| + bool can_show_bubble) { |
| + UpdateZoomIcon(can_show_bubble); |
| } |
| void LocationBarViewGtk::SetStarred(bool starred) { |
| @@ -1295,29 +1294,30 @@ void LocationBarViewGtk::SetStarred(bool starred) { |
| UpdateStarIcon(); |
| } |
| -void LocationBarViewGtk::UpdateZoomIcon() { |
| +void LocationBarViewGtk::UpdateZoomIcon(bool can_show_bubble) { |
| if (!zoom_.get() || !GetWebContents()) |
| return; |
| - const ZoomController* zc = TabContents::FromWebContents( |
| - GetWebContents())->zoom_controller(); |
| - |
| - if (toolbar_model_->input_in_progress() || |
| - zc->zoom_icon_state() == ZoomController::NONE) { |
| + const ZoomController* zc = GetTabContents()->zoom_controller(); |
| + if (toolbar_model_->input_in_progress() || zc->IsAtDefaultZoom()) { |
| gtk_widget_hide(zoom_.get()); |
| ZoomBubbleGtk::Close(); |
| return; |
| } |
| - gtk_widget_show(zoom_.get()); |
| - int zoom_resource = zc->zoom_icon_state() == ZoomController::ZOOM_PLUS_ICON ? |
| - IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; |
| + int zoom_percent = zc->zoom_percent(); |
| + int zoom_resource = zoom_percent > 100 ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS; |
| gtk_image_set_from_pixbuf(GTK_IMAGE(zoom_image_), |
| theme_service_->GetImageNamed(zoom_resource)->ToGdkPixbuf()); |
| - string16 tooltip = l10n_util::GetStringFUTF16Int(IDS_TOOLTIP_ZOOM, |
| - zc->zoom_percent()); |
| + string16 tooltip = |
| + l10n_util::GetStringFUTF16Int(IDS_TOOLTIP_ZOOM, zoom_percent); |
| gtk_widget_set_tooltip_text(zoom_.get(), UTF16ToUTF8(tooltip).c_str()); |
| + |
| + gtk_widget_show(zoom_.get()); |
| + |
| + if (can_show_bubble) |
| + ZoomBubbleGtk::Show(zoom_.get(), browser_->profile(), zoom_percent, true); |
| } |
| void LocationBarViewGtk::UpdateStarIcon() { |