Index: ios/chrome/app/main_controller.mm |
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm |
index 833e747a19cef643c9fba5444a30775d6d4bcce0..2880c22b24d617253abbe72d6e0ccf5e5b3a4b8f 100644 |
--- a/ios/chrome/app/main_controller.mm |
+++ b/ios/chrome/app/main_controller.mm |
@@ -18,8 +18,6 @@ |
#import "base/mac/bind_objc_block.h" |
#include "base/mac/bundle_locations.h" |
#include "base/mac/foundation_util.h" |
-#include "base/mac/objc_property_releaser.h" |
-#import "base/mac/scoped_nsobject.h" |
#include "base/macros.h" |
#include "base/path_service.h" |
#include "base/strings/sys_string_conversions.h" |
@@ -148,6 +146,10 @@ |
#import "net/base/mac/url_conversions.h" |
#include "net/url_request/url_request_context.h" |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
namespace { |
// Preference key used to store which profile is current. |
@@ -246,27 +248,25 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// at any given time, usually |_mainCoordinator|. |
// Main coordinator, backing object for the property of the same name, which |
// lazily initializes on access. |
- base::scoped_nsobject<MainCoordinator> _mainCoordinator; |
+ MainCoordinator* _mainCoordinator; |
gambard
2017/06/12 12:42:47
Can probably be synthesize instead.
marq (ping after 24h)
2017/06/12 14:25:09
The lazy init behavior, coupled with a few places
gambard
2017/06/12 14:44:54
Sorry my comment was unclear. The ivar declaration
marq (ping after 24h)
2017/06/12 16:25:29
Gotcha. Done.
|
// Wrangler to handle BVC and tab model creation, access, and related logic. |
// Implements faetures exposed from this object through the |
// BrowserViewInformation protocol. |
- base::scoped_nsobject<BrowserViewWrangler> _browserViewWrangler; |
+ BrowserViewWrangler* _browserViewWrangler; |
// Parameters received at startup time when the app is launched from another |
// app. |
- base::scoped_nsobject<AppStartupParameters> _startupParameters; |
+ AppStartupParameters* _startupParameters; |
// Navigation View controller for the settings. |
- base::scoped_nsobject<SettingsNavigationController> |
- _settingsNavigationController; |
+ SettingsNavigationController* _settingsNavigationController; |
// View controller for switching tabs. |
- base::scoped_nsobject<UIViewController<TabSwitcher>> _tabSwitcherController; |
+ UIViewController<TabSwitcher>* _tabSwitcherController; |
// Controller to display the re-authentication flow. |
- base::scoped_nsobject<SigninInteractionController> |
- _signinInteractionController; |
+ SigninInteractionController* _signinInteractionController; |
// The number of memory warnings that have been received in this |
// foreground session. |
@@ -291,7 +291,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
BOOL _isColdStart; |
// Keeps track of the restore state during startup. |
- base::scoped_nsobject<CrashRestoreHelper> _restoreHelper; |
+ CrashRestoreHelper* _restoreHelper; |
// An object to record metrics related to the user's first action. |
std::unique_ptr<FirstUserActionRecorder> _firstUserActionRecorder; |
@@ -326,39 +326,36 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
PrefChangeRegistrar _localStatePrefChangeRegistrar; |
// Clears browsing data from ChromeBrowserStates. |
- base::scoped_nsobject<BrowsingDataRemovalController> |
- _browsingDataRemovalController; |
+ BrowsingDataRemovalController* _browsingDataRemovalController; |
// The class in charge of showing/hiding the memory debugger when the |
// appropriate pref changes. |
- base::scoped_nsobject<MemoryDebuggerManager> _memoryDebuggerManager; |
- |
- base::mac::ObjCPropertyReleaser _propertyReleaser_MainController; |
+ MemoryDebuggerManager* _memoryDebuggerManager; |
// Responsible for indexing chrome links (such as bookmarks, most likely...) |
// in system Spotlight index. |
- base::scoped_nsobject<SpotlightManager> _spotlightManager; |
+ SpotlightManager* _spotlightManager; |
// Cached launchOptions from -didFinishLaunchingWithOptions. |
- base::scoped_nsobject<NSDictionary> _launchOptions; |
+ NSDictionary* _launchOptions; |
// View controller for displaying the history panel. |
- base::scoped_nsobject<UIViewController> _historyPanelViewController; |
+ UIViewController* _historyPanelViewController; |
// Variable backing metricsMediator property. |
- base::WeakNSObject<MetricsMediator> _metricsMediator; |
+ __weak MetricsMediator* _metricsMediator; |
// Hander for the startup tasks, deferred or not. |
- base::scoped_nsobject<StartupTasks> _startupTasks; |
+ StartupTasks* _startupTasks; |
} |
// Pointer to the main view controller, always owned by the main window. |
-@property(nonatomic, readonly) MainViewController* mainViewController; |
+@property(weak, nonatomic, readonly) MainViewController* mainViewController; |
// The main coordinator, lazily created the first time it is accessed. Manages |
// the MainViewController. This property should not be accessed before the |
// browser has started up to the FOREGROUND stage. |
-@property(nonatomic, readonly) MainCoordinator* mainCoordinator; |
+@property(weak, nonatomic, readonly) MainCoordinator* mainCoordinator; |
// A property to track whether the QR Scanner should be started upon tab |
// switcher dismissal. It can only be YES if the QR Scanner experiment is |
@@ -553,8 +550,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (instancetype)init { |
if ((self = [super init])) { |
- _propertyReleaser_MainController.Init(self, [MainController class]); |
- _startupTasks.reset([[StartupTasks alloc] init]); |
+ _startupTasks = [[StartupTasks alloc] init]; |
} |
return self; |
} |
@@ -564,7 +560,6 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
net::RequestTracker::SetRequestTrackerFactory(nullptr); |
[NSObject cancelPreviousPerformRequestsWithTarget:self]; |
- [super dealloc]; |
} |
// This function starts up to only what is needed at each stage of the |
@@ -686,22 +681,22 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// until the BVC receives the browser state and tab model. |
BOOL postCrashLaunch = [self mustShowRestoreInfobar]; |
if (postCrashLaunch) { |
- _restoreHelper.reset( |
- [[CrashRestoreHelper alloc] initWithBrowserState:chromeBrowserState]); |
+ _restoreHelper = |
+ [[CrashRestoreHelper alloc] initWithBrowserState:chromeBrowserState]; |
[_restoreHelper moveAsideSessionInformation]; |
} |
// Initialize and set the main browser state. |
[self initializeBrowserState:chromeBrowserState]; |
_mainBrowserState = chromeBrowserState; |
- _browserViewWrangler.reset([[BrowserViewWrangler alloc] |
- initWithBrowserState:_mainBrowserState |
- tabModelObserver:self]); |
+ _browserViewWrangler = |
+ [[BrowserViewWrangler alloc] initWithBrowserState:_mainBrowserState |
+ tabModelObserver:self]; |
// Ensure the main tab model is created. |
ignore_result([_browserViewWrangler mainTabModel]); |
- _spotlightManager.reset([[SpotlightManager |
- spotlightManagerWithBrowserState:_mainBrowserState] retain]); |
+ _spotlightManager = |
+ [SpotlightManager spotlightManagerWithBrowserState:_mainBrowserState]; |
ShareExtensionService* service = |
ShareExtensionServiceFactory::GetForBrowserState(_mainBrowserState); |
@@ -736,7 +731,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
[self openTabFromLaunchOptions:_launchOptions |
startupInformation:self |
appState:self.appState]; |
- _launchOptions.reset(); |
+ _launchOptions = nil; |
mojo::edk::Init(); |
@@ -745,7 +740,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// infobar is displayed now, it may be dismissed immediately and the user |
// will never be able to restore the session. |
[_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; |
- _restoreHelper.reset(); |
+ _restoreHelper = nil; |
} |
[self scheduleTasksRequiringBVCWithBrowserState]; |
@@ -761,9 +756,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
ios::TemplateURLServiceFactory::GetForBrowserState(browserState)); |
if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { |
- base::scoped_nsobject<TouchToSearchPermissionsMediator> |
- touchToSearchPermissions([[TouchToSearchPermissionsMediator alloc] |
- initWithBrowserState:browserState]); |
+ TouchToSearchPermissionsMediator* touchToSearchPermissions = |
+ [[TouchToSearchPermissionsMediator alloc] |
+ initWithBrowserState:browserState]; |
if (experimental_flags::IsForceResetContextualSearchEnabled()) { |
[touchToSearchPermissions setPreferenceState:TouchToSearch::UNDECIDED]; |
} |
@@ -782,12 +777,12 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
[self markEulaAsAccepted]; |
- if (_startupParameters.get()) { |
+ if (_startupParameters) { |
[self dismissModalsAndOpenSelectedTabInMode:ApplicationMode::NORMAL |
withURL:[_startupParameters externalURL] |
transition:ui::PAGE_TRANSITION_LINK |
completion:nil]; |
- _startupParameters.reset(); |
+ _startupParameters = nil; |
} |
} |
@@ -844,8 +839,8 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (BrowsingDataRemovalController*)browsingDataRemovalController { |
if (!_browsingDataRemovalController) { |
- _browsingDataRemovalController.reset( |
- [[BrowsingDataRemovalController alloc] initWithDelegate:self]); |
+ _browsingDataRemovalController = |
+ [[BrowsingDataRemovalController alloc] initWithDelegate:self]; |
} |
return _browsingDataRemovalController; |
} |
@@ -879,7 +874,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
- (void)setLaunchOptions:(NSDictionary*)launchOptions { |
- _launchOptions.reset([launchOptions retain]); |
+ _launchOptions = launchOptions; |
} |
#pragma mark - Property implementation. |
@@ -893,7 +888,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
- (void)setStartupParameters:(AppStartupParameters*)startupParameters { |
- _startupParameters.reset([startupParameters retain]); |
+ _startupParameters = startupParameters; |
} |
- (MainViewController*)mainViewController { |
@@ -907,8 +902,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
if (!_mainCoordinator) { |
// Lazily create the main coordinator. |
- _mainCoordinator.reset( |
- [[MainCoordinator alloc] initWithWindow:self.window]); |
+ _mainCoordinator = [[MainCoordinator alloc] initWithWindow:self.window]; |
} |
return _mainCoordinator; |
} |
@@ -922,7 +916,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
- (void)setMetricsMediator:(MetricsMediator*)metricsMediator { |
- _metricsMediator.reset(metricsMediator); |
+ _metricsMediator = metricsMediator; |
} |
- (SettingsNavigationController*)settingsNavigationController { |
gambard
2017/06/12 12:42:48
Same
marq (ping after 24h)
2017/06/12 14:25:09
Done.
|
@@ -931,7 +925,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)setSettingsNavigationController: |
(SettingsNavigationController*)settingsNavigationController { |
- _settingsNavigationController.reset([settingsNavigationController retain]); |
+ _settingsNavigationController = settingsNavigationController; |
} |
#pragma mark - StartupInformation implementation. |
@@ -958,9 +952,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)stopChromeMain { |
[_spotlightManager shutdown]; |
- _spotlightManager.reset(); |
+ _spotlightManager = nil; |
- _browserViewWrangler.reset(); |
+ _browserViewWrangler = nil; |
_chromeMain.reset(); |
} |
@@ -1159,11 +1153,10 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
[[DeferredInitializationRunner sharedInstance] |
enqueueBlockNamed:kMemoryDebuggingToolsStartup |
block:^{ |
- _memoryDebuggerManager.reset( |
- [[MemoryDebuggerManager alloc] |
- initWithView:self.window |
- prefs:GetApplicationContext() |
- ->GetLocalState()]); |
+ _memoryDebuggerManager = [[MemoryDebuggerManager alloc] |
+ initWithView:self.window |
+ prefs:GetApplicationContext() |
+ ->GetLocalState()]; |
}]; |
} |
} |
@@ -1298,7 +1291,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
if (firstRun) { |
[self showFirstRunUI]; |
// Do not ever show the 'restore' infobar during first run. |
- _restoreHelper.reset(); |
+ _restoreHelper = nil; |
} |
} |
@@ -1317,13 +1310,13 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
name:kChromeFirstRunUIDidFinishNotification |
object:nil]; |
- base::scoped_nsobject<WelcomeToChromeViewController> welcomeToChrome( |
+ WelcomeToChromeViewController* welcomeToChrome = |
[[WelcomeToChromeViewController alloc] |
initWithBrowserState:_mainBrowserState |
- tabModel:self.mainTabModel]); |
- base::scoped_nsobject<UINavigationController> navController( |
+ tabModel:self.mainTabModel]; |
+ UINavigationController* navController = |
[[OrientationLimitingNavigationController alloc] |
- initWithRootViewController:welcomeToChrome]); |
+ initWithRootViewController:welcomeToChrome]; |
[navController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; |
CGRect appFrame = [[UIScreen mainScreen] bounds]; |
[[navController view] setFrame:appFrame]; |
@@ -1389,9 +1382,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// Make sure we have the BVC here with a valid profile. |
DCHECK([self.currentBVC browserState]); |
- base::scoped_nsobject<OrientationLimitingNavigationController> navController( |
+ OrientationLimitingNavigationController* navController = |
[[OrientationLimitingNavigationController alloc] |
- initWithRootViewController:promo]); |
+ initWithRootViewController:promo]; |
// Avoid presenting the promo if the current device orientation is not |
// supported. The promo will be presented at a later moment, when the device |
@@ -1430,11 +1423,11 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
case IDC_OPTIONS: |
[self showSettings]; |
break; |
- case IDC_REPORT_AN_ISSUE: |
+ case IDC_REPORT_AN_ISSUE: { |
dispatch_async(dispatch_get_main_queue(), ^{ |
[self showReportAnIssue]; |
}); |
- break; |
+ } break; |
gambard
2017/06/12 12:42:48
Is this cl format? Why is break outside of the bra
|
case IDC_SHOW_SIGNIN_IOS: { |
ShowSigninCommand* command = |
base::mac::ObjCCastStrict<ShowSigninCommand>(sender); |
@@ -1465,7 +1458,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
case IDC_SHOW_HISTORY: |
[self showHistory]; |
break; |
- case IDC_TOGGLE_TAB_SWITCHER: |
+ case IDC_TOGGLE_TAB_SWITCHER: { |
DCHECK(!_tabSwitcherIsActive); |
if (!_isProcessingVoiceSearchCommand) { |
[self showTabSwitcher]; |
@@ -1476,11 +1469,12 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
_isProcessingTabSwitcherCommand = NO; |
}); |
} |
- break; |
+ } break; |
+ |
case IDC_PRELOAD_VOICE_SEARCH: |
[self.currentBVC chromeExecuteCommand:sender]; |
break; |
- case IDC_VOICE_SEARCH: |
+ case IDC_VOICE_SEARCH: { |
if (!_isProcessingTabSwitcherCommand) { |
[self startVoiceSearch]; |
_isProcessingVoiceSearchCommand = YES; |
@@ -1490,7 +1484,8 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
_isProcessingVoiceSearchCommand = NO; |
}); |
} |
- break; |
+ } break; |
+ |
case IDC_CLEAR_BROWSING_DATA_IOS: { |
// Clear both the main browser state and the associated incognito |
// browser state. |
@@ -1670,7 +1665,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// deleted. All of the request trackers associated with the closed OTR tabs |
// will have posted CancelRequest calls to the IO thread by now; this just |
// waits for those calls to run before calling |deleteIncognitoBrowserState|. |
- web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlock(^{ |
+ web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlockArc(^{ |
[self deleteIncognitoBrowserState]; |
})); |
@@ -1762,24 +1757,24 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// which will cache the first snapshot for the tab and reuse it instead of |
// regenerating a new one each time. |
[currentTab setSnapshotCoalescingEnabled:YES]; |
- base::ScopedClosureRunner runner(base::BindBlock(^{ |
+ base::ScopedClosureRunner runner(base::BindBlockArc(^{ |
[currentTab setSnapshotCoalescingEnabled:NO]; |
})); |
[currentBVC prepareToEnterTabSwitcher:nil]; |
- if (!_tabSwitcherController.get()) { |
+ if (!_tabSwitcherController) { |
if (IsIPadIdiom()) { |
- _tabSwitcherController.reset([[TabSwitcherController alloc] |
+ _tabSwitcherController = [[TabSwitcherController alloc] |
initWithBrowserState:_mainBrowserState |
mainTabModel:self.mainTabModel |
otrTabModel:self.otrTabModel |
- activeTabModel:self.currentTabModel]); |
+ activeTabModel:self.currentTabModel]; |
} else { |
- _tabSwitcherController.reset([[StackViewController alloc] |
+ _tabSwitcherController = [[StackViewController alloc] |
initWithMainTabModel:self.mainTabModel |
otrTabModel:self.otrTabModel |
- activeTabModel:self.currentTabModel]); |
+ activeTabModel:self.currentTabModel]; |
} |
} else { |
// The StackViewController is kept in memory to avoid the performance hit of |
@@ -1888,7 +1883,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)finishDismissingStackView { |
DCHECK_EQ(self.mainViewController.activeViewController, |
- _tabSwitcherController.get()); |
+ _tabSwitcherController); |
if (_modeToDisplayOnStackViewDismissal == StackViewDismissalMode::NORMAL) { |
self.currentBVC = self.mainBVC; |
@@ -1961,9 +1956,8 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)presentSignedInAccountsViewControllerForBrowserState: |
(ios::ChromeBrowserState*)browserState { |
- base::scoped_nsobject<UIViewController> accountsViewController( |
- [[SignedInAccountsViewController alloc] |
- initWithBrowserState:browserState]); |
+ UIViewController* accountsViewController = [ |
+ [SignedInAccountsViewController alloc] initWithBrowserState:browserState]; |
[[self topPresentedViewController] |
presentViewController:accountsViewController |
animated:YES |
@@ -1976,10 +1970,10 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
[[DeferredInitializationRunner sharedInstance] |
runBlockIfNecessary:kPrefObserverInit]; |
DCHECK(_localStatePrefObserverBridge); |
- _settingsNavigationController.reset([SettingsNavigationController |
+ _settingsNavigationController = [SettingsNavigationController |
newSettingsMainControllerWithMainBrowserState:_mainBrowserState |
currentBrowserState:self.currentBrowserState |
- delegate:self]); |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -1993,9 +1987,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
NOTREACHED(); |
return; |
} |
- _settingsNavigationController.reset([SettingsNavigationController |
+ _settingsNavigationController = [SettingsNavigationController |
newAccountsController:self.currentBrowserState |
- delegate:self]); |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2005,10 +1999,10 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showSyncSettings { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
- newSyncController:_mainBrowserState |
- allowSwitchSyncAccount:YES |
- delegate:self]); |
+ _settingsNavigationController = |
+ [SettingsNavigationController newSyncController:_mainBrowserState |
+ allowSwitchSyncAccount:YES |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2018,9 +2012,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showSavePasswordsSettings { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
- newSavePasswordsController:_mainBrowserState |
- delegate:self]); |
+ _settingsNavigationController = |
+ [SettingsNavigationController newSavePasswordsController:_mainBrowserState |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2030,9 +2024,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showAutofillSettings { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
- newAutofillController:_mainBrowserState |
- delegate:self]); |
+ _settingsNavigationController = |
+ [SettingsNavigationController newAutofillController:_mainBrowserState |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2042,10 +2036,10 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showReportAnIssue { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
- newUserFeedbackController:_mainBrowserState |
- delegate:self |
- feedbackDataSource:self]); |
+ _settingsNavigationController = |
+ [SettingsNavigationController newUserFeedbackController:_mainBrowserState |
+ delegate:self |
+ feedbackDataSource:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2055,9 +2049,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showSyncEncryptionPassphrase { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
+ _settingsNavigationController = [SettingsNavigationController |
newSyncEncryptionPassphraseController:_mainBrowserState |
- delegate:self]); |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2067,9 +2061,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showClearBrowsingDataSettingsController { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
+ _settingsNavigationController = [SettingsNavigationController |
newClearBrowsingDataController:_mainBrowserState |
- delegate:self]); |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2079,9 +2073,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)showContextualSearchSettingsController { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
+ _settingsNavigationController = [SettingsNavigationController |
newContextualSearchController:_mainBrowserState |
- delegate:self]); |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2102,15 +2096,15 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
BOOL areSettingsPresented = _settingsNavigationController != NULL; |
- _signinInteractionController.reset([[SigninInteractionController alloc] |
+ _signinInteractionController = [[SigninInteractionController alloc] |
initWithBrowserState:_mainBrowserState |
presentingViewController:[self topPresentedViewController] |
isPresentedOnSettings:areSettingsPresented |
accessPoint:accessPoint |
- promoAction:promoAction]); |
+ promoAction:promoAction]; |
signin_ui::CompletionCallback completion = ^(BOOL success) { |
- _signinInteractionController.reset(); |
+ _signinInteractionController = nil; |
if (callback) |
callback(success); |
}; |
@@ -2142,25 +2136,25 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
BOOL areSettingsPresented = _settingsNavigationController != NULL; |
- _signinInteractionController.reset([[SigninInteractionController alloc] |
+ _signinInteractionController = [[SigninInteractionController alloc] |
initWithBrowserState:_mainBrowserState |
presentingViewController:[self topPresentedViewController] |
isPresentedOnSettings:areSettingsPresented |
accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN |
promoAction:signin_metrics::PromoAction:: |
- PROMO_ACTION_NO_SIGNIN_PROMO]); |
+ PROMO_ACTION_NO_SIGNIN_PROMO]; |
[_signinInteractionController |
addAccountWithCompletion:^(BOOL success) { |
- _signinInteractionController.reset(); |
+ _signinInteractionController = nil; |
} |
viewController:self.mainViewController]; |
} |
- (void)showHistory { |
- _historyPanelViewController.reset([[HistoryPanelViewController |
+ _historyPanelViewController = [HistoryPanelViewController |
controllerToPresentForBrowserState:_mainBrowserState |
- loader:self.currentBVC] retain]); |
+ loader:self.currentBVC]; |
[self.currentBVC presentViewController:_historyPanelViewController |
animated:YES |
completion:nil]; |
@@ -2176,7 +2170,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (ShowSigninCommandCompletionCallback)successfulSigninCompletion: |
(ProceduralBlock)callback { |
- return [[^(BOOL successful) { |
+ return [^(BOOL successful) { |
ios::ChromeBrowserState* browserState = [self currentBrowserState]; |
if (browserState->IsOffTheRecord()) { |
NOTREACHED() |
@@ -2188,15 +2182,15 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
ios::SigninManagerFactory::GetForBrowserState(browserState); |
if (signinManager->IsAuthenticated()) |
callback(); |
- } copy] autorelease]; |
+ } copy]; |
} |
- (void)showNativeAppsSettings { |
if (_settingsNavigationController) |
return; |
- _settingsNavigationController.reset([SettingsNavigationController |
- newNativeAppsController:_mainBrowserState |
- delegate:self]); |
+ _settingsNavigationController = |
+ [SettingsNavigationController newNativeAppsController:_mainBrowserState |
+ delegate:self]; |
[[self topPresentedViewController] |
presentViewController:_settingsNavigationController |
animated:YES |
@@ -2215,7 +2209,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
if (completion) |
completion(); |
}]; |
- _settingsNavigationController.reset(); |
+ _settingsNavigationController = nil; |
} |
#pragma mark - TabModelObserver |
@@ -2341,7 +2335,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// restore infobar if needed. |
dispatch_async(dispatch_get_main_queue(), ^{ |
[_restoreHelper showRestoreIfNeeded:[self currentTabModel]]; |
- _restoreHelper.reset(); |
+ _restoreHelper = nil; |
}); |
} |
@@ -2563,15 +2557,15 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
} |
- (UIViewController<TabSwitcher>*)tabSwitcherController { |
gambard
2017/06/12 12:42:48
Synthesize?
marq (ping after 24h)
2017/06/12 14:25:09
These properties are only declared in the TestingO
gambard
2017/06/12 14:44:54
Acknowledged.
|
- return _tabSwitcherController.get(); |
+ return _tabSwitcherController; |
} |
- (void)setTabSwitcherController:(UIViewController<TabSwitcher>*)controller { |
- _tabSwitcherController.reset([controller retain]); |
+ _tabSwitcherController = controller; |
} |
- (SigninInteractionController*)signinInteractionController { |
gambard
2017/06/12 12:42:48
Synthesize?
marq (ping after 24h)
2017/06/12 14:25:09
See above.
|
- return _signinInteractionController.get(); |
+ return _signinInteractionController; |
} |
- (UIViewController*)topPresentedViewController { |
@@ -2589,9 +2583,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
- (void)setStartupParametersWithURL:(const GURL&)launchURL { |
NSString* sourceApplication = @"Fake App"; |
- _startupParameters.reset([[ChromeAppStartupParameters |
+ _startupParameters = [ChromeAppStartupParameters |
newChromeAppStartupParametersWithURL:net::NSURLWithGURL(launchURL) |
- fromSourceApplication:sourceApplication] retain]); |
+ fromSourceApplication:sourceApplication]; |
} |
- (void)setUpAsForegrounded { |
@@ -2600,9 +2594,9 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
// Create a BrowserViewWrangler with a null browser state. This will trigger |
// assertions if the BrowserViewWrangler is asked to create any BVC or |
// tabModel objects, but it will accept assignments to them. |
- _browserViewWrangler.reset([[BrowserViewWrangler alloc] |
- initWithBrowserState:nullptr |
- tabModelObserver:self]); |
+ _browserViewWrangler = |
+ [[BrowserViewWrangler alloc] initWithBrowserState:nullptr |
+ tabModelObserver:self]; |
// This is a test utility method that bypasses the ususal setup steps, so |
// verify that the main coordinator hasn't been created yet, then start it |
// via lazy initialization. |
@@ -2616,7 +2610,7 @@ enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
int removeAllMask = ~0; |
scoped_refptr<CallbackCounter> callbackCounter = |
- new CallbackCounter(base::BindBlock(^{ |
+ new CallbackCounter(base::BindBlockArc(^{ |
[self setUpCurrentBVCForTesting]; |
if (completionHandler) { |
completionHandler(); |