| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" | 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" |
| 6 | 6 |
| 7 #include "base/mac/objc_release_properties.h" | 7 #include "base/mac/objc_property_releaser.h" |
| 8 | 8 |
| 9 @implementation NewTabPageBarItem { | 9 @implementation NewTabPageBarItem { |
| 10 // Title of the button. | 10 // Title of the button. |
| 11 NSString* title_; | 11 NSString* title_; |
| 12 // A numeric identifier. | 12 // A numeric identifier. |
| 13 NSUInteger identifier_; | 13 NSUInteger identifier_; |
| 14 // Tabbar image. | 14 // Tabbar image. |
| 15 UIImage* image_; | 15 UIImage* image_; |
| 16 // New tab page view. | 16 // New tab page view. |
| 17 __unsafe_unretained UIView* view_; // weak | 17 __unsafe_unretained UIView* view_; // weak |
| 18 base::mac::ObjCPropertyReleaser propertyReleaser_NewTabPageBarItem_; |
| 18 } | 19 } |
| 19 | 20 |
| 20 @synthesize title = title_; | 21 @synthesize title = title_; |
| 21 @synthesize identifier = identifier_; | 22 @synthesize identifier = identifier_; |
| 22 @synthesize image = image_; | 23 @synthesize image = image_; |
| 23 @synthesize view = view_; | 24 @synthesize view = view_; |
| 24 | 25 |
| 25 + (NewTabPageBarItem*)newTabPageBarItemWithTitle:(NSString*)title | 26 + (NewTabPageBarItem*)newTabPageBarItemWithTitle:(NSString*)title |
| 26 identifier:(NSUInteger)identifier | 27 identifier:(NSUInteger)identifier |
| 27 image:(UIImage*)image { | 28 image:(UIImage*)image { |
| 28 NewTabPageBarItem* item = [[[NewTabPageBarItem alloc] init] autorelease]; | 29 NewTabPageBarItem* item = [[[NewTabPageBarItem alloc] init] autorelease]; |
| 29 if (item) { | 30 if (item) { |
| 30 item.title = title; | 31 item.title = title; |
| 31 item.identifier = identifier; | 32 item.identifier = identifier; |
| 32 item.image = image; | 33 item.image = image; |
| 33 } | 34 } |
| 34 return item; | 35 return item; |
| 35 } | 36 } |
| 36 | 37 |
| 37 - (void)dealloc { | 38 - (id)init { |
| 38 base::mac::ReleaseProperties(self); | 39 self = [super init]; |
| 39 [super dealloc]; | 40 if (self) { |
| 41 propertyReleaser_NewTabPageBarItem_.Init(self, [NewTabPageBarItem class]); |
| 42 } |
| 43 return self; |
| 40 } | 44 } |
| 41 | 45 |
| 42 @end | 46 @end |
| OLD | NEW |