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

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

Issue 1387383004: Plumb NotifierId to status icon balloons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notif_cleanup
Patch Set: Rebase Created 5 years, 2 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"
11 #include "skia/ext/skia_utils_mac.h" 11 #include "skia/ext/skia_utils_mac.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #import "ui/base/cocoa/menu_controller.h" 13 #import "ui/base/cocoa/menu_controller.h"
14 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
15 #include "ui/message_center/notifier_settings.h"
15 16
16 @interface StatusItemController : NSObject { 17 @interface StatusItemController : NSObject {
17 StatusIconMac* statusIcon_; // weak 18 StatusIconMac* statusIcon_; // weak
18 } 19 }
19 - (id)initWithIcon:(StatusIconMac*)icon; 20 - (id)initWithIcon:(StatusIconMac*)icon;
20 - (void)handleClick:(id)sender; 21 - (void)handleClick:(id)sender;
21 22
22 @end // @interface StatusItemController 23 @end // @interface StatusItemController
23 24
24 @implementation StatusItemController 25 @implementation StatusItemController
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // 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.
77 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]); 78 toolTip_.reset([base::SysUTF16ToNSString(tool_tip) retain]);
78 if (menu_.get()) { 79 if (menu_.get()) {
79 SetToolTip(nil); 80 SetToolTip(nil);
80 CreateMenu([menu_ model], toolTip_.get()); 81 CreateMenu([menu_ model], toolTip_.get());
81 } else { 82 } else {
82 SetToolTip(toolTip_.get()); 83 SetToolTip(toolTip_.get());
83 } 84 }
84 } 85 }
85 86
86 void StatusIconMac::DisplayBalloon(const gfx::ImageSkia& icon, 87 void StatusIconMac::DisplayBalloon(
87 const base::string16& title, 88 const gfx::ImageSkia& icon,
88 const base::string16& contents) { 89 const base::string16& title,
89 notification_.DisplayBalloon(icon, title, contents); 90 const base::string16& contents,
91 const message_center::NotifierId& notifier_id) {
92 notification_.DisplayBalloon(icon, title, contents, notifier_id);
90 } 93 }
91 94
92 bool StatusIconMac::HasStatusIconMenu() { 95 bool StatusIconMac::HasStatusIconMenu() {
93 return menu_.get() != nil; 96 return menu_.get() != nil;
94 } 97 }
95 98
96 void StatusIconMac::UpdatePlatformContextMenu(StatusIconMenuModel* model) { 99 void StatusIconMac::UpdatePlatformContextMenu(StatusIconMenuModel* model) {
97 if (!model) { 100 if (!model) {
98 menu_.reset(); 101 menu_.reset();
99 } else { 102 } else {
(...skipping 15 matching lines...) Expand all
115 useWithPopUpButtonCell:YES]); 118 useWithPopUpButtonCell:YES]);
116 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0]; 119 NSMenuItem* toolTipItem = [[menu_ menu] itemAtIndex:0];
117 [toolTipItem setTitle:toolTip]; 120 [toolTipItem setTitle:toolTip];
118 } 121 }
119 [item() setMenu:[menu_ menu]]; 122 [item() setMenu:[menu_ menu]];
120 } 123 }
121 124
122 void StatusIconMac::SetToolTip(NSString* toolTip) { 125 void StatusIconMac::SetToolTip(NSString* toolTip) {
123 [item() setToolTip:toolTip]; 126 [item() setToolTip:toolTip];
124 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698