diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 07:50:29 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 07:50:29 +0000 |
commit | ae0918b4342050e5106cec594e217d12ca44fbfb (patch) | |
tree | 4131755d1bb754595296b48bbba20aabcdada8de | |
parent | e2589739314a9b8b04f96335af88c7f34e1d34a1 (diff) | |
download | chromium_src-ae0918b4342050e5106cec594e217d12ca44fbfb.zip chromium_src-ae0918b4342050e5106cec594e217d12ca44fbfb.tar.gz chromium_src-ae0918b4342050e5106cec594e217d12ca44fbfb.tar.bz2 |
[mac] Use the cross-platform menu model for the notifications options menu, instead of something mac-specific.
BUG=none
TEST=create notification on mac, the options menu should work normally
Review URL: http://codereview.chromium.org/3020015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53024 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/notifications/balloon_controller.h | 6 | ||||
-rw-r--r-- | chrome/browser/cocoa/notifications/balloon_controller.mm | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/notifications/balloon_controller.h b/chrome/browser/cocoa/notifications/balloon_controller.h index 8257bc1..f5fb0ba 100644 --- a/chrome/browser/cocoa/notifications/balloon_controller.h +++ b/chrome/browser/cocoa/notifications/balloon_controller.h @@ -14,6 +14,9 @@ #import "chrome/browser/cocoa/notifications/balloon_view_host_mac.h" #include "chrome/browser/notifications/balloon.h" +@class MenuController; +class NotificationOptionsMenuModel; + // The Balloon controller creates the view elements to display a // notification balloon, resize it if the HTML contents of that // balloon change, and move it when the collection of balloons is @@ -38,7 +41,8 @@ // The options menu that appears when "options" is pressed. IBOutlet NSButton* optionsButton_; - scoped_nsobject<NSMenu> optionsMenu_; + scoped_ptr<NotificationOptionsMenuModel> menuModel_; + scoped_nsobject<MenuController> menuController_; // The host for the renderer of the HTML contents. scoped_ptr<BalloonViewHost> htmlContents_; diff --git a/chrome/browser/cocoa/notifications/balloon_controller.mm b/chrome/browser/cocoa/notifications/balloon_controller.mm index bad636a..08d47a6 100644 --- a/chrome/browser/cocoa/notifications/balloon_controller.mm +++ b/chrome/browser/cocoa/notifications/balloon_controller.mm @@ -9,9 +9,11 @@ #import "base/cocoa_protocols_mac.h" #import "base/scoped_nsobject.h" #include "base/utf_string_conversions.h" +#import "chrome/browser/cocoa/menu_controller.h" #include "chrome/browser/cocoa/notifications/balloon_view_host_mac.h" #include "chrome/browser/notifications/balloon.h" #include "chrome/browser/notifications/desktop_notification_service.h" +#include "chrome/browser/notifications/notification_options_menu_model.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "grit/generated_resources.h" @@ -34,6 +36,9 @@ const int kRightMargin = 1; if ((self = [super initWithWindowNibName:@"Notification"])) { balloon_ = balloon; [self initializeHost]; + menuModel_.reset(new NotificationOptionsMenuModel(balloon)); + menuController_.reset([[MenuController alloc] initWithModel:menuModel_.get() + useWithPopUpButtonCell:NO]); } return self; } @@ -47,14 +52,6 @@ const int kRightMargin = 1; DCHECK(image); [optionsButton_ setImage:image]; - optionsMenu_.reset([[NSMenu alloc] init]); - NSString* revokeText = l10n_util::GetNSStringF( - IDS_NOTIFICATION_BALLOON_REVOKE_MESSAGE, - WideToUTF16(balloon_->notification().display_source())); - [optionsMenu_ addItemWithTitle:revokeText - action:@selector(permissionRevoked:) - keyEquivalent:@""]; - NSString* sourceLabelText = l10n_util::GetNSStringF( IDS_NOTIFICATION_BALLOON_SOURCE_LABEL, WideToUTF16(balloon_->notification().display_source())); @@ -68,7 +65,7 @@ const int kRightMargin = 1; } - (IBAction)optionsButtonPressed:(id)sender { - [NSMenu popUpContextMenu:optionsMenu_ + [NSMenu popUpContextMenu:[menuController_ menu] withEvent:[NSApp currentEvent] forView:optionsButton_]; } |