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

Side by Side Diff: ios/chrome/app/application_delegate/app_state.h

Issue 2580363002: Upstream Chrome on iOS source code [1/11]. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
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_APP_STATE_H_
6 #define IOS_CHROME_APP_APPLICATION_DELEGATE_APP_STATE_H_
7
8 #import <UIKit/UIKit.h>
9
10 @protocol AppNavigation;
11 @protocol BrowserLauncher;
12 @protocol BrowserViewInformation;
13 @protocol TabOpening;
14 @protocol TabSwitching;
15 @protocol StartupInformation;
16 @class DeviceSharingManager;
17 @class MainApplicationDelegate;
18 @class MemoryWarningHelper;
19 @class MetricsMediator;
20 @class TabModel;
21
22 // Represents the application state and responds to application state changes
23 // and system events.
24 @interface AppState : NSObject
25
26 - (instancetype)init NS_UNAVAILABLE;
27
28 - (instancetype)
29 initWithBrowserLauncher:(id<BrowserLauncher>)browserLauncher
30 startupInformation:(id<StartupInformation>)startupInformation
31 applicationDelegate:(MainApplicationDelegate*)applicationDelegate
32 NS_DESIGNATED_INITIALIZER;
33
34 // YES if the user has ever interacted with the application. May be NO if the
35 // application has been woken up by the system for background work.
36 @property(nonatomic, readonly) BOOL userInteracted;
37
38 // Window for the application, it is not set during the initialization method.
39 // Set the property before calling methods related to it.
40 @property(nonatomic, assign) UIWindow* window;
41
42 // Saves the launchOptions to be used from -newTabFromLaunchOptions. If the
43 // application is in background, initialize the browser to basic. If not, launch
44 // the browser.
45 // Returns whether additional delegate handling should be performed (call to
46 // -performActionForShortcutItem or -openURL by the system for example)
47 - (BOOL)requiresHandlingAfterLaunchWithOptions:(NSDictionary*)launchOptions
48 stateBackground:(BOOL)stateBackground;
49
50 // Whether the application is in Safe Mode.
51 - (BOOL)isInSafeMode;
52
53 // Logs duration of the session in the main tab model and records that chrome is
54 // no longer in cold start.
55 - (void)willResignActiveTabModel;
56
57 // Called when the application is getting terminated. It stops all outgoing
58 // requests, config updates, clears the device sharing manager and stops the
59 // mainChrome instance.
60 - (void)applicationWillTerminate:(UIApplication*)application
61 applicationNavigation:(id<AppNavigation>)appNavigation;
62
63 // Resumes the session: reinitializing metrics and opening new tab if necessary.
64 // User sessions are defined in terms of BecomeActive/ResignActive so that
65 // session boundaries include things like turning the screen off or getting a
66 // phone call, not just switching apps.
67 - (void)resumeSessionWithTabOpener:(id<TabOpening>)tabOpener
68 tabSwitcher:(id<TabSwitching>)tabSwitcher;
69
70 // Called when going into the background. iOS already broadcasts, so
71 // stakeholders can register for it directly.
72 - (void)applicationDidEnterBackground:(UIApplication*)application
73 memoryHelper:(MemoryWarningHelper*)memoryHelper
74 tabSwitcherIsActive:(BOOL)tabSwitcherIsActive;
75
76 // Called when returning to the foreground. Resets and uploads the metrics.
77 // Starts the browser to foreground if needed.
78 - (void)applicationWillEnterForeground:(UIApplication*)application
79 metricsMediator:(MetricsMediator*)metricsMediator
80 memoryHelper:(MemoryWarningHelper*)memoryHelper
81 tabOpener:(id<TabOpening>)tabOpener
82 appNavigation:(id<AppNavigation>)appNavigation;
83
84 // Sets the return value for -didFinishLaunchingWithOptions that determines if
85 // UIKit should make followup delegate calls such as
86 // -performActionForShortcutItem or -openURL.
87 - (void)launchFromURLHandled:(BOOL)URLHandled;
88
89 @end
90
91 #endif // IOS_CHROME_APP_APPLICATION_DELEGATE_APP_STATE_H_
OLDNEW
« no previous file with comments | « ios/chrome/app/application_delegate/app_navigation.h ('k') | ios/chrome/app/application_delegate/app_state.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698