Commit a3d678e3 authored by rsesek@chromium.org's avatar rsesek@chromium.org

[MC] Add the product name to the tray controller's title.

BUG=247814

Review URL: https://chromiumcodereview.appspot.com/22441006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217045 0039d316-1c4b-4281-b951-d872f2087c98
parent bf38a26e
......@@ -13210,6 +13210,11 @@ Some features may be unavailable. Please check that the profile exists and you
<message name="IDS_NOTIFICATION_POSITION_UPPER_RIGHT" desc="Menu label for positioning in upper right corner">
Upper right
</message>
<if expr="is_macosx">
<message name="IDS_MESSAGE_CENTER_FOOTER_WITH_PRODUCT_TITLE" desc="The label in the footer of the message center tray, with the product title.">
<ph name="product_name">$1<ex>Chrome</ex></ph> Notifications
</message>
</if>
<!-- Mac AppleScript -->
<if expr="is_macosx">
......
......@@ -9,12 +9,14 @@
#include "base/message_loop/message_loop.h"
#include "chrome/browser/browser_process.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/ui_strings.h"
#include "ui/base/l10n/l10n_util.h"
#import "ui/base/l10n/l10n_util_mac.h"
#import "ui/message_center/cocoa/popup_collection.h"
#import "ui/message_center/cocoa/status_item_view.h"
#import "ui/message_center/cocoa/tray_controller.h"
#import "ui/message_center/cocoa/tray_view_controller.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray.h"
......@@ -119,6 +121,9 @@ void MessageCenterTrayBridge::OpenTrayWindow() {
DCHECK(!tray_controller_);
tray_controller_.reset(
[[MCTrayController alloc] initWithMessageCenterTray:tray_.get()]);
[[tray_controller_ viewController] setTrayTitle:
l10n_util::GetNSStringF(IDS_MESSAGE_CENTER_FOOTER_WITH_PRODUCT_TITLE,
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))];
UpdateStatusItem();
......
......@@ -32,6 +32,8 @@ MESSAGE_CENTER_EXPORT
id clickEventMonitor_;
}
@property(readonly, nonatomic) MCTrayViewController* viewController;
// Designated initializer.
- (id)initWithMessageCenterTray:(message_center::MessageCenterTray*)tray;
......
......@@ -69,6 +69,10 @@
[super dealloc];
}
- (MCTrayViewController*)viewController {
return viewController_.get();
}
- (void)close {
[viewController_ onWindowClosing];
[super close];
......
......@@ -13,6 +13,7 @@
#include "base/mac/scoped_block.h"
#import "base/mac/scoped_nsobject.h"
#include "base/strings/string16.h"
#include "ui/message_center/message_center_export.h"
@class HoverImageButton;
......@@ -107,6 +108,9 @@ MESSAGE_CENTER_EXPORT
testingAnimationEndedCallback_;
}
// The title that is displayed at the top of the message center tray.
@property(copy, nonatomic) NSString* trayTitle;
// Designated initializer.
- (id)initWithMessageCenter:(message_center::MessageCenter*)messageCenter;
......
......@@ -35,7 +35,7 @@ const int kBackButtonSize = 16;
frozen_ = frozen;
}
-(NSPoint)constrainScrollPoint:(NSPoint)proposedNewOrigin {
- (NSPoint)constrainScrollPoint:(NSPoint)proposedNewOrigin {
return frozen_ ? [self documentVisibleRect].origin :
[super constrainScrollPoint:proposedNewOrigin];
}
......@@ -110,6 +110,15 @@ const CGFloat kTrayBottomMargin = 75;
return self;
}
- (NSString*)trayTitle {
return [title_ stringValue];
}
- (void)setTrayTitle:(NSString*)title {
[title_ setStringValue:title];
[title_ sizeToFit];
}
- (void)onWindowClosing {
if (animation_) {
[animation_ stopAnimation];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment