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

Unified Diff: ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm

Issue 2626073003: [ObjC ARC] Converts ios/chrome/browser/ui/contextual_search:contextual_search to ARC. (Closed)
Patch Set: format 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/contextual_search/touch_to_search_permissions_mediator.mm
diff --git a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm
index ce48928e87d6e4f2240e1c138de329cf95c1e112..7a2598c6ad439360bbc488f0ca1527a4b163d35d 100644
--- a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm
+++ b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator.mm
@@ -7,7 +7,6 @@
#import <UIKit/UIKit.h>
#include "base/command_line.h"
-#import "base/ios/weak_nsobject.h"
#include "base/logging.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
@@ -22,6 +21,10 @@
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#include "net/base/network_change_notifier.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
// Maps pref string values to state enum.
const struct {
@@ -37,8 +40,7 @@ const struct {
@interface TouchToSearchPermissionsMediator ()<PrefObserverDelegate> {
ios::ChromeBrowserState* _browserState;
SyncSetupService* _syncService;
- base::WeakNSProtocol<NSObject<TouchToSearchPermissionsChangeAudience>*>
- _audience;
+ __weak NSObject<TouchToSearchPermissionsChangeAudience>* _audience;
// Pref observer to track changes to the touch-to-search and search engine
// prefs.
std::unique_ptr<PrefObserverBridge> _prefObserverBridge;
@@ -89,7 +91,6 @@ const struct {
if ((self = [super init])) {
if (browserState && browserState->IsOffTheRecord()) {
// Discard the allocated object and return a nil object.
- [self release];
return nil;
}
[self setUpBrowserState:browserState];
@@ -105,7 +106,6 @@ const struct {
- (void)dealloc {
// Set audience to nil to stop observation.
self.audience = nil;
- [super dealloc];
}
- (void)setUpBrowserState:(ios::ChromeBrowserState*)browserState {
@@ -146,7 +146,7 @@ const struct {
- (void)setAudience:
(NSObject<TouchToSearchPermissionsChangeAudience>*)audience {
[self stopObserving];
- _audience.reset(audience);
+ _audience = audience;
[self startObserving];
}
@@ -270,8 +270,8 @@ const struct {
if (self.audience) {
if ([self.audience
respondsToSelector:@selector(touchToSearchPermissionsUpdated)]) {
- base::WeakNSProtocol<NSObject<TouchToSearchPermissionsChangeAudience>*>
- audience(self.audience);
+ __weak NSObject<TouchToSearchPermissionsChangeAudience>* audience =
+ self.audience;
dispatch_async(dispatch_get_main_queue(), ^{
[audience touchToSearchPermissionsUpdated];
});

Powered by Google App Engine
This is Rietveld 408576698