1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef IOS_CHROME_APP_APPLICATION_DELEGATE_USER_ACTIVITY_HANDLER_H_ 6 #define IOS_CHROME_APP_APPLICATION_DELEGATE_USER_ACTIVITY_HANDLER_H_ 7 8 #import <UIKit/UIKit.h> 9 10 @protocol BrowserInterfaceProvider; 11 @protocol ConnectionInformation; 12 class ChromeBrowserState; 13 @protocol StartupInformation; 14 @protocol TabOpening; 15 16 // TODO(crbug.com/619598): When the refactoring is over, check if it can be 17 // merged with StartupInformation. 18 // Handles all events based on user activity, as defined in 19 // UIApplicationDelegate. 20 @interface UserActivityHandler : NSObject 21 22 // If the userActivity is a Handoff or an opening from Spotlight, opens a new 23 // tab or setup startupParameters to open it later. If a new tab must be 24 // opened immediately (e.g. if a Siri Shortcut was triggered by the user while 25 // Chrome was already in the foreground), it will be done with the provided 26 // |browserState|. Returns wether it could continue userActivity. 27 + (BOOL)continueUserActivity:(NSUserActivity*)userActivity 28 applicationIsActive:(BOOL)applicationIsActive 29 tabOpener:(id<TabOpening>)tabOpener 30 connectionInformation:(id<ConnectionInformation>)connectionInformation 31 startupInformation:(id<StartupInformation>)startupInformation 32 browserState:(ChromeBrowserState*)browserState; 33 34 // Handles the 3D touch application static items. If the First Run UI is active, 35 // |completionHandler| will be called with NO. 36 + (void)performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem 37 completionHandler:(void (^)(BOOL succeeded))completionHandler 38 tabOpener:(id<TabOpening>)tabOpener 39 connectionInformation: 40 (id<ConnectionInformation>)connectionInformation 41 startupInformation:(id<StartupInformation>)startupInformation 42 interfaceProvider: 43 (id<BrowserInterfaceProvider>)interfaceProvider; 44 45 // Returns YES if Chrome is passing a Handoff to itself or if it is an opening 46 // from Spotlight. 47 + (BOOL)willContinueUserActivityWithType:(NSString*)userActivityType; 48 49 // Opens a new Tab or routes to correct Tab. 50 + (void)handleStartupParametersWithTabOpener:(id<TabOpening>)tabOpener 51 connectionInformation: 52 (id<ConnectionInformation>)connectionInformation 53 startupInformation: 54 (id<StartupInformation>)startupInformation 55 browserState:(ChromeBrowserState*)browserState; 56 57 @end 58 59 #endif // IOS_CHROME_APP_APPLICATION_DELEGATE_USER_ACTIVITY_HANDLER_H_ 60