| 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 #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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 [item_ setEnabled:YES]; | 59 [item_ setEnabled:YES]; |
| 60 [item_ setTarget:controller_]; | 60 [item_ setTarget:controller_]; |
| 61 [item_ setAction:@selector(handleClick:)]; | 61 [item_ setAction:@selector(handleClick:)]; |
| 62 [item_ setHighlightMode:YES]; | 62 [item_ setHighlightMode:YES]; |
| 63 } | 63 } |
| 64 return item_.get(); | 64 return item_.get(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void StatusIconMac::SetImage(const gfx::ImageSkia& image) { | 67 void StatusIconMac::SetImage(const gfx::ImageSkia& image) { |
| 68 if (!image.isNull()) { | 68 if (!image.isNull()) { |
| 69 NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap()); | 69 NSImage* ns_image = skia::SkBitmapToNSImage(*image.bitmap()); |
| 70 if (ns_image) | 70 if (ns_image) |
| 71 [item() setImage:ns_image]; | 71 [item() setImage:ns_image]; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 void StatusIconMac::SetToolTip(const base::string16& tool_tip) { | 75 void StatusIconMac::SetToolTip(const base::string16& tool_tip) { |
| 76 // If we have a status icon menu, make the tool tip part of the menu instead | 76 // If we have a status icon menu, make the tool tip part of the menu instead |
| 77 // of a pop-up tool tip when hovering the mouse over the image. | 77 // of a pop-up tool tip when hovering the mouse over the image. |
| 78 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]); | 78 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]); |
| 79 if (menu_.get()) { | 79 if (menu_.get()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 useWithPopUpButtonCell:YES]); | 118 useWithPopUpButtonCell:YES]); |
| 119 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0]; | 119 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0]; |
| 120 [toolTipItem setTitle:toolTip]; | 120 [toolTipItem setTitle:toolTip]; |
| 121 } | 121 } |
| 122 [item() setMenu:[menu_ menu]]; | 122 [item() setMenu:[menu_ menu]]; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void StatusIconMac::SetToolTip(NSString* toolTip) { | 125 void StatusIconMac::SetToolTip(NSString* toolTip) { |
| 126 [item() setToolTip:toolTip]; | 126 [item() setToolTip:toolTip]; |
| 127 } | 127 } |
| OLD | NEW |