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

Side by Side Diff: chrome/browser/notifications/notification_builder_mac.h

Issue 2053613002: Make the notification builder more XPC friendly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert unintended change Created 4 years, 6 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/notifications/notification_builder_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/mac/scoped_nsobject.h"
11
12 @class NSUserNotification;
13
14 namespace notification_builder {
15 extern NSString* const kNotificationOrigin;
16 extern NSString* const kNotificationId;
17 extern NSString* const kNotificationProfileId;
18 extern NSString* const kNotificationIncognito;
19 } // notification_builder
20
21 // Provides a marshallable way for storing the information required to construct
22 // a NSUSerNotification that is to be displayed on the system.
23 //
24 // A quick example:
25 // base::scoped_nsobject<NotificationBuilder> builder(
26 // [[NotificationBuilder alloc] init]);
27 // [builder setTitle:@"Hello"];
28 //
29 // // Build a notification out of the data.
30 // NSUserNotification* notification =
31 // [builder buildUserNotification];
32 //
33 // // Serialize a notification out of the data.
34 // NSDictionary* notificationData = [builder buildDictionary];
35 //
36 // // Deserialize the |notificationData| in to a new builder.
37 // base::scoped_nsobject<NotificationBuilder> finalBuilder(
38 // [[NotificationBuilder alloc] initWithData:notificationData]);
39 @interface NotificationBuilder : NSObject
40
41 // Initializes an empty builder.
42 - (instancetype)init;
43
44 // Initializes a builder by deserializing |data|. The |data| must have been
45 // generated by calling the buildDictionary function on another builder
46 // instance.
47 - (instancetype)initWithDictionary:(NSDictionary*)data;
48
49 // Setters
50 - (void)setTitle:(NSString*)title;
51 - (void)setSubTitle:(NSString*)subTitle;
52 - (void)setContextMessage:(NSString*)contextMessage;
53 - (void)setIcon:(NSImage*)icon;
54 - (void)setButtons:(NSString*)primaryButton
55 secondaryButton:(NSString*)secondaryButton;
56 - (void)setTag:(NSString*)tag;
57 - (void)setOrigin:(NSString*)origin;
58 - (void)setNotificationId:(NSString*)notificationId;
59 - (void)setProfileId:(NSString*)profileId;
60 - (void)setIncognito:(BOOL)incognito;
61
62 // Returns a notification ready to be displayed out of the provided
63 // |notificationData|.
64 - (NSUserNotification*)buildUserNotification;
65
66 // Returns a representation of a notification that can be serialized.
67 // Another instance of NotificationBuilder can read this directly and generate
68 // a notification out of it via the |buildbuildUserNotification| method.
69 - (NSDictionary*)buildDictionary;
70
71 @end
72
73 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_BUILDER_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/notifications/notification_builder_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698