Merge pull request #11654 from sethlu/set-notification-close-button-text

feat: Set macOS notification close button title
This commit is contained in:
Cheng Zhao 2018-02-15 16:01:30 +09:00 committed by GitHub
commit af92b04eb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 133 additions and 21 deletions

View file

@ -88,6 +88,10 @@ void CocoaNotification::Show(const NotificationOptions& options) {
[notification_ setHasReplyButton:true];
}
if (!options.close_button_text.empty()) {
[notification_ setOtherButtonTitle:base::SysUTF16ToNSString(options.close_button_text)];
}
[NSUserNotificationCenter.defaultUserNotificationCenter
deliverNotification:notification_];
}

View file

@ -28,13 +28,14 @@ struct NotificationOptions {
base::string16 subtitle;
base::string16 msg;
std::string tag;
bool silent;
GURL icon_url;
SkBitmap icon;
bool silent;
bool has_reply;
base::string16 reply_placeholder;
base::string16 sound;
std::vector<NotificationAction> actions;
base::string16 close_button_text;
};
class Notification {