| 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 #include "chrome/browser/notifications/notification_builder_mac.h" | 5 #include "chrome/browser/notifications/notification_builder_mac.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 NSString* const kNotificationIncognito = @"notificationIncognito"; | 35 NSString* const kNotificationIncognito = @"notificationIncognito"; |
| 36 | 36 |
| 37 } // namespace notification_builder | 37 } // namespace notification_builder |
| 38 | 38 |
| 39 @implementation NotificationBuilder { | 39 @implementation NotificationBuilder { |
| 40 base::scoped_nsobject<NSMutableDictionary> notificationData_; | 40 base::scoped_nsobject<NSMutableDictionary> notificationData_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 - (instancetype)init { | 43 - (instancetype)init { |
| 44 if ((self = [super init])) { | 44 if ((self = [super init])) { |
| 45 notificationData_ = [[NSMutableDictionary alloc] init]; | 45 notificationData_.reset([[NSMutableDictionary alloc] init]); |
| 46 } | 46 } |
| 47 return self; | 47 return self; |
| 48 } | 48 } |
| 49 | 49 |
| 50 - (instancetype)initWithDictionary:(NSDictionary*)data { | 50 - (instancetype)initWithDictionary:(NSDictionary*)data { |
| 51 if ((self = [super init])) { | 51 if ((self = [super init])) { |
| 52 notificationData_ = [data copy]; | 52 notificationData_.reset([data copy]); |
| 53 } | 53 } |
| 54 return self; | 54 return self; |
| 55 } | 55 } |
| 56 | 56 |
| 57 - (void)setTitle:(NSString*)title { | 57 - (void)setTitle:(NSString*)title { |
| 58 if (title.length) | 58 if (title.length) |
| 59 [notificationData_ setObject:title forKey:kNotificationTitle]; | 59 [notificationData_ setObject:title forKey:kNotificationTitle]; |
| 60 } | 60 } |
| 61 | 61 |
| 62 - (void)setSubTitle:(NSString*)subTitle { | 62 - (void)setSubTitle:(NSString*)subTitle { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 return toast.autorelease(); | 207 return toast.autorelease(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 - (NSDictionary*)buildDictionary { | 210 - (NSDictionary*)buildDictionary { |
| 211 return [[notificationData_ copy] autorelease]; | 211 return [[notificationData_ copy] autorelease]; |
| 212 } | 212 } |
| 213 | 213 |
| 214 @end | 214 @end |
| OLD | NEW |