Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm

Issue 10736028: Refactor browser window zoom handling and enable zoom icon on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
6
7 #include "base/string_number_conversions.h"
8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
10 #include "chrome/browser/ui/toolbar/toolbar_model.h"
11 #include "chrome/browser/ui/zoom/zoom_controller.h"
12 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util_mac.h"
14
15 ZoomDecoration::ZoomDecoration(ToolbarModel* toolbar_model)
16 : toolbar_model_(toolbar_model) {
17 Update(NULL);
18 }
19
20 ZoomDecoration::~ZoomDecoration() {
21 }
22
23 void ZoomDecoration::Update(ZoomController* zoom_controller) {
24 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() ||
25 toolbar_model_->input_in_progress()) {
26 // TODO(dbeam): hide zoom bubble when it exists.
27 SetVisible(false);
28 return;
29 }
30
31 SetImage(OmniboxViewMac::ImageForResource(
32 zoom_controller->GetResourceForZoomLevel()));
33
34 int zoom_percent = zoom_controller->zoom_percent();
35 tooltip_.reset([l10n_util::GetNSStringFWithFixup(
36 IDS_TOOLTIP_ZOOM, base::IntToString16(zoom_percent)) retain]);
Scott Hess - ex-Googler 2012/08/16 04:52:58 There's a lot going on in this line, I think it mi
Dan Beam 2012/08/16 08:55:03 Done.
37
38 SetVisible(true);
39 }
40
41 NSString* ZoomDecoration::GetToolTip() {
42 return tooltip_.get();
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698