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

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: . 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/string16.h"
8 #include "base/string_number_conversions.h"
9 #include "chrome/app/chrome_command_ids.h"
10 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
11 #include "chrome/browser/ui/toolbar/toolbar_model.h"
12 #include "chrome/browser/ui/zoom/zoom_controller.h"
13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util_mac.h"
15
16 ZoomDecoration::ZoomDecoration(ToolbarModel* toolbar_model)
17 : toolbar_model_(toolbar_model) {
18 Update(NULL);
19 }
20
21 ZoomDecoration::~ZoomDecoration() {
22 }
23
24 void ZoomDecoration::Update(ZoomController* zoom_controller) {
25 if (!zoom_controller || zoom_controller->IsAtDefaultZoom() ||
26 toolbar_model_->input_in_progress()) {
27 // TODO(dbeam): hide zoom bubble when it exists.
28 SetVisible(false);
29 return;
30 }
31
32 SetImage(OmniboxViewMac::ImageForResource(
33 zoom_controller->GetResourceForZoomLevel()));
34
35 string16 zoom_percent = base::IntToString16(zoom_controller->zoom_percent());
36 NSString* zoom_string =
37 l10n_util::GetNSStringFWithFixup(IDS_TOOLTIP_ZOOM, zoom_percent);
38 tooltip_.reset([zoom_string retain]);
39
40 SetVisible(true);
41 }
42
43 bool ZoomDecoration::AcceptsMousePress() {
44 return true;
45 }
46
47 NSString* ZoomDecoration::GetToolTip() {
48 return tooltip_.get();
49 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/zoom_decoration.h ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698