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

Side by Side Diff: chrome/browser/ui/cocoa/status_icons/status_icon_mac.mm

Issue 464163003: Remove IDR_STATUS_TRAY_ICON_PRESSED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the comment Created 6 years, 3 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
OLDNEW
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/cocoa/status_icons/status_icon_mac.h" 5 #include "chrome/browser/ui/cocoa/status_icons/status_icon_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void StatusIconMac::SetImage(const gfx::ImageSkia& image) { 66 void StatusIconMac::SetImage(const gfx::ImageSkia& image) {
67 if (!image.isNull()) { 67 if (!image.isNull()) {
68 NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap()); 68 NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap());
69 if (ns_image) 69 if (ns_image)
70 [item() setImage:ns_image]; 70 [item() setImage:ns_image];
71 } 71 }
72 } 72 }
73 73
74 void StatusIconMac::SetPressedImage(const gfx::ImageSkia& image) {
75 if (!image.isNull()) {
76 NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap());
77 if (ns_image)
78 [item() setAlternateImage:ns_image];
79 }
80 }
81
82 void StatusIconMac::SetToolTip(const base::string16& tool_tip) { 74 void StatusIconMac::SetToolTip(const base::string16& tool_tip) {
83 // If we have a status icon menu, make the tool tip part of the menu instead 75 // If we have a status icon menu, make the tool tip part of the menu instead
84 // of a pop-up tool tip when hovering the mouse over the image. 76 // of a pop-up tool tip when hovering the mouse over the image.
85 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]); 77 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]);
86 if (menu_.get()) { 78 if (menu_.get()) {
87 SetToolTip(nil); 79 SetToolTip(nil);
88 CreateMenu([menu_ model], toolTip_.get()); 80 CreateMenu([menu_ model], toolTip_.get());
89 } else { 81 } else {
90 SetToolTip(toolTip_.get()); 82 SetToolTip(toolTip_.get());
91 } 83 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 useWithPopUpButtonCell:YES]); 115 useWithPopUpButtonCell:YES]);
124 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0]; 116 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0];
125 [toolTipItem setTitle:toolTip]; 117 [toolTipItem setTitle:toolTip];
126 } 118 }
127 [item() setMenu:[menu_ menu]]; 119 [item() setMenu:[menu_ menu]];
128 } 120 }
129 121
130 void StatusIconMac::SetToolTip(NSString* toolTip) { 122 void StatusIconMac::SetToolTip(NSString* toolTip) {
131 [item() setToolTip:toolTip]; 123 [item() setToolTip:toolTip];
132 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698