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/app/main_controller.h" | 5 #import "ios/chrome/app/main_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #import <CoreSpotlight/CoreSpotlight.h> | 10 #import <CoreSpotlight/CoreSpotlight.h> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 NSString* const kCleanupCrashReports = @"CleanupCrashReports"; | 189 NSString* const kCleanupCrashReports = @"CleanupCrashReports"; |
190 | 190 |
191 // Constants for deferring the deletion of old snapshots. | 191 // Constants for deferring the deletion of old snapshots. |
192 NSString* const kPurgeSnapshots = @"PurgeSnapshots"; | 192 NSString* const kPurgeSnapshots = @"PurgeSnapshots"; |
193 | 193 |
194 // Constants for deferring startup Spotlight bookmark indexing. | 194 // Constants for deferring startup Spotlight bookmark indexing. |
195 NSString* const kStartSpotlightBookmarksIndexing = | 195 NSString* const kStartSpotlightBookmarksIndexing = |
196 @"StartSpotlightBookmarksIndexing"; | 196 @"StartSpotlightBookmarksIndexing"; |
197 | 197 |
198 // Constants for deferred initialization of dynamic application shortcut items. | 198 // Constants for deferred initialization of dynamic application shortcut items. |
199 NSString* const kAddApplicationShortcutItems = @"AddApplicationShortcutItems"; | 199 NSString* const kAddApplicationShortcutItems = @"AddApplicationShortcutItems"; |
sdefresne
2017/02/03 15:47:28
Remove.
| |
200 | 200 |
201 // Constants for deferred promo display. | 201 // Constants for deferred promo display. |
202 const NSTimeInterval kDisplayPromoDelay = 0.1; | 202 const NSTimeInterval kDisplayPromoDelay = 0.1; |
203 | 203 |
204 // A rough estimate of the expected duration of a view controller transition | 204 // A rough estimate of the expected duration of a view controller transition |
205 // animation. It's used to temporarily disable mutally exclusive chrome | 205 // animation. It's used to temporarily disable mutally exclusive chrome |
206 // commands that trigger a view controller presentation. | 206 // commands that trigger a view controller presentation. |
207 const int64_t kExpectedTransitionDurationInNanoSeconds = 0.2 * NSEC_PER_SEC; | 207 const int64_t kExpectedTransitionDurationInNanoSeconds = 0.2 * NSEC_PER_SEC; |
208 | 208 |
209 // Adapted from chrome/browser/ui/browser_init.cc. | 209 // Adapted from chrome/browser/ui/browser_init.cc. |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
939 - (SettingsNavigationController*)settingsNavigationController { | 939 - (SettingsNavigationController*)settingsNavigationController { |
940 return _settingsNavigationController; | 940 return _settingsNavigationController; |
941 } | 941 } |
942 | 942 |
943 - (void)setSettingsNavigationController: | 943 - (void)setSettingsNavigationController: |
944 (SettingsNavigationController*)settingsNavigationController { | 944 (SettingsNavigationController*)settingsNavigationController { |
945 _settingsNavigationController.reset([settingsNavigationController retain]); | 945 _settingsNavigationController.reset([settingsNavigationController retain]); |
946 } | 946 } |
947 | 947 |
948 - (BOOL)startQRScannerAfterTabSwitcherDismissal { | 948 - (BOOL)startQRScannerAfterTabSwitcherDismissal { |
949 return (experimental_flags::IsQRCodeReaderEnabled() && | 949 return _startQRScannerAfterTabSwitcherDismissal; |
950 _startQRScannerAfterTabSwitcherDismissal); | |
951 } | 950 } |
952 | 951 |
953 - (void)setStartQRScannerAfterTabSwitcherDismissal:(BOOL)startQRScanner { | 952 - (void)setStartQRScannerAfterTabSwitcherDismissal:(BOOL)startQRScanner { |
954 _startQRScannerAfterTabSwitcherDismissal = startQRScanner; | 953 _startQRScannerAfterTabSwitcherDismissal = startQRScanner; |
955 } | 954 } |
956 | 955 |
957 #pragma mark - StartupInformation implementation. | 956 #pragma mark - StartupInformation implementation. |
958 | 957 |
959 - (FirstUserActionRecorder*)firstUserActionRecorder { | 958 - (FirstUserActionRecorder*)firstUserActionRecorder { |
960 return _firstUserActionRecorder.get(); | 959 return _firstUserActionRecorder.get(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1205 // Deferred tasks. | 1204 // Deferred tasks. |
1206 [self schedulePrefObserverInitialization]; | 1205 [self schedulePrefObserverInitialization]; |
1207 [self scheduleMemoryDebuggingTools]; | 1206 [self scheduleMemoryDebuggingTools]; |
1208 [_startupTasks scheduleDeferredBrowserStateInitialization:_mainBrowserState]; | 1207 [_startupTasks scheduleDeferredBrowserStateInitialization:_mainBrowserState]; |
1209 [self scheduleAuthenticationServiceNotification]; | 1208 [self scheduleAuthenticationServiceNotification]; |
1210 [self sendQueuedFeedback]; | 1209 [self sendQueuedFeedback]; |
1211 [self scheduleSpotlightResync]; | 1210 [self scheduleSpotlightResync]; |
1212 [self scheduleDeleteDownloadsDirectory]; | 1211 [self scheduleDeleteDownloadsDirectory]; |
1213 [self scheduleStartupAttemptReset]; | 1212 [self scheduleStartupAttemptReset]; |
1214 [self scheduleFreeMemoryMonitoring]; | 1213 [self scheduleFreeMemoryMonitoring]; |
1215 [self scheduleAddApplicationShortcutItems]; | |
1216 [self scheduleAppDistributionPings]; | 1214 [self scheduleAppDistributionPings]; |
1217 [self scheduleCheckNativeApps]; | 1215 [self scheduleCheckNativeApps]; |
1218 } | 1216 } |
1219 | 1217 |
1220 - (void)scheduleTasksRequiringBVCWithBrowserState { | 1218 - (void)scheduleTasksRequiringBVCWithBrowserState { |
1221 if (GetApplicationContext()->WasLastShutdownClean()) | 1219 if (GetApplicationContext()->WasLastShutdownClean()) |
1222 [self.mainBVC removeExternalFilesImmediately:NO completionHandler:nil]; | 1220 [self.mainBVC removeExternalFilesImmediately:NO completionHandler:nil]; |
1223 | 1221 |
1224 [self scheduleShowPromo]; | 1222 [self scheduleShowPromo]; |
1225 } | 1223 } |
(...skipping 11 matching lines...) Expand all Loading... | |
1237 return; | 1235 return; |
1238 } | 1236 } |
1239 ProceduralBlock block = ^{ | 1237 ProceduralBlock block = ^{ |
1240 [_spotlightManager resyncIndex]; | 1238 [_spotlightManager resyncIndex]; |
1241 }; | 1239 }; |
1242 [[DeferredInitializationRunner sharedInstance] | 1240 [[DeferredInitializationRunner sharedInstance] |
1243 enqueueBlockNamed:kStartSpotlightBookmarksIndexing | 1241 enqueueBlockNamed:kStartSpotlightBookmarksIndexing |
1244 block:block]; | 1242 block:block]; |
1245 } | 1243 } |
1246 | 1244 |
1247 - (void)scheduleAddApplicationShortcutItems { | |
1248 ProceduralBlock block = ^{ | |
1249 if (experimental_flags::IsQRCodeReaderEnabled()) { | |
1250 UIApplicationShortcutItem* qrScannerShortcutItem = [[ | |
1251 [UIApplicationShortcutItem alloc] | |
1252 initWithType:@"OpenQRScanner" | |
1253 localizedTitle:l10n_util::GetNSString( | |
1254 IDS_IOS_APPLICATION_SHORTCUT_QR_SCANNER_TITLE) | |
1255 localizedSubtitle:nil | |
1256 icon:[UIApplicationShortcutIcon | |
1257 iconWithTemplateImageName: | |
1258 @"quick_action_qr_scanner"] | |
1259 userInfo:nil] autorelease]; | |
1260 // Note: The following only affects dynamic shortcut items defined | |
1261 // programmatically, and not static shortcut items set in the Info.plist | |
1262 // file. | |
1263 [[UIApplication sharedApplication] | |
1264 setShortcutItems:@[ qrScannerShortcutItem ]]; | |
1265 } else { | |
1266 [[UIApplication sharedApplication] setShortcutItems:nil]; | |
1267 } | |
1268 }; | |
1269 | |
1270 [[DeferredInitializationRunner sharedInstance] | |
1271 enqueueBlockNamed:kAddApplicationShortcutItems | |
1272 block:block]; | |
1273 } | |
1274 | |
1275 - (void)expireFirstUserActionRecorder { | 1245 - (void)expireFirstUserActionRecorder { |
1276 // Clear out any scheduled calls to this method. For example, the app may have | 1246 // Clear out any scheduled calls to this method. For example, the app may have |
1277 // been backgrounded before the |kFirstUserActionTimeout| expired. | 1247 // been backgrounded before the |kFirstUserActionTimeout| expired. |
1278 [NSObject | 1248 [NSObject |
1279 cancelPreviousPerformRequestsWithTarget:self | 1249 cancelPreviousPerformRequestsWithTarget:self |
1280 selector:@selector( | 1250 selector:@selector( |
1281 expireFirstUserActionRecorder) | 1251 expireFirstUserActionRecorder) |
1282 object:nil]; | 1252 object:nil]; |
1283 | 1253 |
1284 if (_firstUserActionRecorder) { | 1254 if (_firstUserActionRecorder) { |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2693 }; | 2663 }; |
2694 | 2664 |
2695 callbackCounter->IncrementCount(); | 2665 callbackCounter->IncrementCount(); |
2696 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2666 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
2697 mask:removeAllMask | 2667 mask:removeAllMask |
2698 timePeriod:browsing_data::ALL_TIME | 2668 timePeriod:browsing_data::ALL_TIME |
2699 completionHandler:decrementCallbackCounterCount]; | 2669 completionHandler:decrementCallbackCounterCount]; |
2700 } | 2670 } |
2701 | 2671 |
2702 @end | 2672 @end |
OLD | NEW |