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

Unified Diff: ios/chrome/browser/ui/history/history_entry_item.mm

Issue 2624963003: [ObjC ARC] Converts ios/chrome/browser/ui/history:history to ARC. (Closed)
Patch Set: Removes the rest of weak and scoped nsobjects. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/history/history_entry_item.mm
diff --git a/ios/chrome/browser/ui/history/history_entry_item.mm b/ios/chrome/browser/ui/history/history_entry_item.mm
index 92a69519df1b727303a9fe8e23f19fc3a9a5e822..9136b33e43e3761788e2ad2f599d6b48d7fe6499 100644
--- a/ios/chrome/browser/ui/history/history_entry_item.mm
+++ b/ios/chrome/browser/ui/history/history_entry_item.mm
@@ -5,9 +5,7 @@
#import "ios/chrome/browser/ui/history/history_entry_item.h"
#include "base/i18n/time_formatting.h"
-#include "base/ios/weak_nsobject.h"
#import "base/mac/foundation_util.h"
-#import "base/mac/objc_property_releaser.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/history/core/browser/url_row.h"
@@ -24,6 +22,10 @@
#import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h"
#include "ui/base/l10n/l10n_util.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
// Size at which the favicon will be displayed.
const CGFloat kFaviconSize = 24.0;
@@ -59,14 +61,12 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
#pragma mark - HistoryEntryItem
@interface HistoryEntryItem ()<FaviconViewProviderDelegate> {
- // Property releaser for HistoryEntryItem.
- base::mac::ObjCPropertyReleaser _propertyReleaser_HistoryEntryItem;
// Delegate for HistoryEntryItem.
- base::WeakNSProtocol<id<HistoryEntryItemDelegate>> _delegate;
+ __weak id<HistoryEntryItemDelegate> _delegate;
}
// FaviconViewProvider to fetch the favicon and format the favicon view.
-@property(nonatomic, retain) FaviconViewProvider* faviconViewProvider;
+@property(nonatomic, strong) FaviconViewProvider* faviconViewProvider;
// Custom accessibility actions for the history entry view.
- (NSArray*)accessibilityActions;
@@ -96,7 +96,6 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
delegate:(id<HistoryEntryItemDelegate>)delegate {
self = [super initWithType:type];
if (self) {
- _propertyReleaser_HistoryEntryItem.Init(self, [HistoryEntryItem class]);
self.cellClass = [HistoryEntryCell class];
favicon::LargeIconService* largeIconService =
IOSChromeLargeIconServiceFactory::GetForBrowserState(browserState);
@@ -112,7 +111,7 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
[base::SysUTF16ToNSString(base::TimeFormatTimeOfDay(entry.time)) copy];
_URL = GURL(entry.url);
_timestamp = entry.time;
- _delegate.reset(delegate);
+ _delegate = delegate;
}
return self;
}
@@ -143,28 +142,28 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
- (NSArray*)accessibilityActions {
UIAccessibilityCustomAction* deleteAction =
- [[[UIAccessibilityCustomAction alloc]
+ [[UIAccessibilityCustomAction alloc]
initWithName:l10n_util::GetNSString(
IDS_HISTORY_ENTRY_ACCESSIBILITY_DELETE)
target:self
- selector:@selector(deleteHistoryEntry)] autorelease];
+ selector:@selector(deleteHistoryEntry)];
UIAccessibilityCustomAction* openInNewTabAction =
- [[[UIAccessibilityCustomAction alloc]
+ [[UIAccessibilityCustomAction alloc]
initWithName:l10n_util::GetNSString(
IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB)
target:self
- selector:@selector(openInNewTab)] autorelease];
+ selector:@selector(openInNewTab)];
UIAccessibilityCustomAction* openInNewIncognitoTabAction =
- [[[UIAccessibilityCustomAction alloc]
+ [[UIAccessibilityCustomAction alloc]
initWithName:l10n_util::GetNSString(
IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB)
target:self
- selector:@selector(openInNewIncognitoTab)] autorelease];
+ selector:@selector(openInNewIncognitoTab)];
UIAccessibilityCustomAction* copyURLAction =
- [[[UIAccessibilityCustomAction alloc]
+ [[UIAccessibilityCustomAction alloc]
initWithName:l10n_util::GetNSString(IDS_IOS_CONTENT_CONTEXT_COPY)
target:self
- selector:@selector(copyURL)] autorelease];
+ selector:@selector(copyURL)];
return @[
deleteAction, openInNewTabAction, openInNewIncognitoTabAction, copyURLAction
];
@@ -220,15 +219,12 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
#pragma mark - HistoryEntryCell
-@interface HistoryEntryCell () {
- // Property releaser for HistoryEntryCell.
- base::mac::ObjCPropertyReleaser _propertyReleaser_HistoryEntryCell;
-}
+@interface HistoryEntryCell ()
-// Redeclare as readwrite to allow property releaser to handle these properties.
-@property(nonatomic, readwrite, retain) UILabel* textLabel;
-@property(nonatomic, readwrite, retain) UILabel* detailTextLabel;
-@property(nonatomic, readwrite, retain) UILabel* timeLabel;
+// Redeclare as readwrite.
+@property(nonatomic, readwrite, strong) UILabel* textLabel;
+@property(nonatomic, readwrite, strong) UILabel* detailTextLabel;
+@property(nonatomic, readwrite, strong) UILabel* timeLabel;
@end
@implementation HistoryEntryCell
@@ -241,7 +237,6 @@ NSString* FormattedTitle(const base::string16& title, const GURL& url) {
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
- _propertyReleaser_HistoryEntryCell.Init(self, [HistoryEntryCell class]);
_faviconViewContainer = [[UIView alloc] initWithFrame:CGRectZero];
« no previous file with comments | « ios/chrome/browser/ui/history/history_entry_item.h ('k') | ios/chrome/browser/ui/history/history_panel_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698