| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 | 11 |
| 12 @class NSUserNotification; | 12 @class NSUserNotification; |
| 13 | 13 |
| 14 namespace notification_builder { | 14 namespace notification_builder { |
| 15 |
| 15 extern NSString* const kNotificationOrigin; | 16 extern NSString* const kNotificationOrigin; |
| 16 extern NSString* const kNotificationId; | 17 extern NSString* const kNotificationId; |
| 17 extern NSString* const kNotificationProfileId; | 18 extern NSString* const kNotificationProfileId; |
| 18 extern NSString* const kNotificationIncognito; | 19 extern NSString* const kNotificationIncognito; |
| 20 |
| 19 } // notification_builder | 21 } // notification_builder |
| 20 | 22 |
| 21 // Provides a marshallable way for storing the information required to construct | 23 // Provides a marshallable way for storing the information required to construct |
| 22 // a NSUSerNotification that is to be displayed on the system. | 24 // a NSUSerNotification that is to be displayed on the system. |
| 23 // | 25 // |
| 24 // A quick example: | 26 // A quick example: |
| 25 // base::scoped_nsobject<NotificationBuilder> builder( | 27 // base::scoped_nsobject<NotificationBuilder> builder( |
| 26 // [[NotificationBuilder alloc] init]); | 28 // [[NotificationBuilder alloc] init]); |
| 27 // [builder setTitle:@"Hello"]; | 29 // [builder setTitle:@"Hello"]; |
| 28 // | 30 // |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 | 42 |
| 41 // Initializes an empty builder. | 43 // Initializes an empty builder. |
| 42 - (instancetype)init; | 44 - (instancetype)init; |
| 43 | 45 |
| 44 // Initializes a builder by deserializing |data|. The |data| must have been | 46 // Initializes a builder by deserializing |data|. The |data| must have been |
| 45 // generated by calling the buildDictionary function on another builder | 47 // generated by calling the buildDictionary function on another builder |
| 46 // instance. | 48 // instance. |
| 47 - (instancetype)initWithDictionary:(NSDictionary*)data; | 49 - (instancetype)initWithDictionary:(NSDictionary*)data; |
| 48 | 50 |
| 49 // Setters | 51 // Setters |
| 52 // Note for XPC users. Always use the setters from Chrome's main app. Do not |
| 53 // attempt to use them from XPC since some of the default strings and other |
| 54 // defaults are not available from the xpc service. |
| 50 - (void)setTitle:(NSString*)title; | 55 - (void)setTitle:(NSString*)title; |
| 51 - (void)setSubTitle:(NSString*)subTitle; | 56 - (void)setSubTitle:(NSString*)subTitle; |
| 52 - (void)setContextMessage:(NSString*)contextMessage; | 57 - (void)setContextMessage:(NSString*)contextMessage; |
| 53 - (void)setIcon:(NSImage*)icon; | 58 - (void)setIcon:(NSImage*)icon; |
| 54 - (void)setButtons:(NSString*)primaryButton | 59 - (void)setButtons:(NSString*)primaryButton |
| 55 secondaryButton:(NSString*)secondaryButton; | 60 secondaryButton:(NSString*)secondaryButton; |
| 56 - (void)setTag:(NSString*)tag; | 61 - (void)setTag:(NSString*)tag; |
| 57 - (void)setOrigin:(NSString*)origin; | 62 - (void)setOrigin:(NSString*)origin; |
| 58 - (void)setNotificationId:(NSString*)notificationId; | 63 - (void)setNotificationId:(NSString*)notificationId; |
| 59 - (void)setProfileId:(NSString*)profileId; | 64 - (void)setProfileId:(NSString*)profileId; |
| 60 - (void)setIncognito:(BOOL)incognito; | 65 - (void)setIncognito:(BOOL)incognito; |
| 61 | 66 |
| 62 // Returns a notification ready to be displayed out of the provided | 67 // Returns a notification ready to be displayed out of the provided |
| 63 // |notificationData|. | 68 // |notificationData|. |
| 64 - (NSUserNotification*)buildUserNotification; | 69 - (NSUserNotification*)buildUserNotification; |
| 65 | 70 |
| 66 // Returns a representation of a notification that can be serialized. | 71 // Returns a representation of a notification that can be serialized. |
| 67 // Another instance of NotificationBuilder can read this directly and generate | 72 // Another instance of NotificationBuilder can read this directly and generate |
| 68 // a notification out of it via the |buildbuildUserNotification| method. | 73 // a notification out of it via the |buildbuildUserNotification| method. |
| 69 - (NSDictionary*)buildDictionary; | 74 - (NSDictionary*)buildDictionary; |
| 70 | 75 |
| 71 @end | 76 @end |
| 72 | 77 |
| 73 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ | 78 #endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_ |
| OLD | NEW |