| 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 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" |
| 7 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 12 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 13 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 13 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 14 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/ui/zoom/zoom_controller.h" | 16 #include "components/ui/zoom/zoom_controller.h" |
| 16 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 bool location_bar_is_dark) { | 35 bool location_bar_is_dark) { |
| 35 if (!ShouldShowDecoration()) { | 36 if (!ShouldShowDecoration()) { |
| 36 if (!IsVisible() && !bubble_) | 37 if (!IsVisible() && !bubble_) |
| 37 return false; | 38 return false; |
| 38 | 39 |
| 39 HideUI(); | 40 HideUI(); |
| 40 return true; | 41 return true; |
| 41 } | 42 } |
| 42 | 43 |
| 43 base::string16 zoom_percent = | 44 base::string16 zoom_percent = |
| 44 base::IntToString16(zoom_controller->GetZoomPercent()); | 45 base::FormatPercent(zoom_controller->GetZoomPercent()); |
| 45 NSString* zoom_string = | 46 NSString* zoom_string = |
| 46 l10n_util::GetNSStringFWithFixup(IDS_TOOLTIP_ZOOM, zoom_percent); | 47 l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent); |
| 47 | 48 |
| 48 if (IsVisible() && [tooltip_ isEqualToString:zoom_string] && | 49 if (IsVisible() && [tooltip_ isEqualToString:zoom_string] && |
| 49 !default_zoom_changed) { | 50 !default_zoom_changed) { |
| 50 return false; | 51 return false; |
| 51 } | 52 } |
| 52 | 53 |
| 53 ShowAndUpdateUI(zoom_controller, zoom_string, location_bar_is_dark); | 54 ShowAndUpdateUI(zoom_controller, zoom_string, location_bar_is_dark); |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // closed the decoration can be hidden. | 173 // closed the decoration can be hidden. |
| 173 if (IsAtDefaultZoom() && IsVisible()) { | 174 if (IsAtDefaultZoom() && IsVisible()) { |
| 174 SetVisible(false); | 175 SetVisible(false); |
| 175 owner_->OnDecorationsChanged(); | 176 owner_->OnDecorationsChanged(); |
| 176 } | 177 } |
| 177 } | 178 } |
| 178 | 179 |
| 179 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { | 180 gfx::VectorIconId ZoomDecoration::GetMaterialVectorIconId() const { |
| 180 return vector_icon_id_; | 181 return vector_icon_id_; |
| 181 } | 182 } |
| OLD | NEW |