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

Unified Diff: ios/chrome/app/app_delegate.mm

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/app/app_delegate.h ('k') | ios/chrome/app/application_delegate/app_navigation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/app/app_delegate.mm
diff --git a/ios/chrome/app/app_delegate.mm b/ios/chrome/app/app_delegate.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2f2b3aa2e3da9f371800c371c36a2da87e2788f9
--- /dev/null
+++ b/ios/chrome/app/app_delegate.mm
@@ -0,0 +1,121 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// ====== New Architecture =====
+// = This code is only used in the new iOS Chrome architecture. =
+// ============================================================================
+
+#import "ios/chrome/app/app_delegate.h"
+
+#import "ios/chrome/app/application_state.h"
+#import "ios/chrome/app/steps/launch_to_background.h"
+#import "ios/chrome/app/steps/launch_to_basic.h"
+#import "ios/chrome/app/steps/launch_to_foreground.h"
+#import "ios/chrome/app/steps/tab_grid_coordinator+application_step.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface AppDelegate ()
+@property(nonatomic, strong) ApplicationState* applicationState;
+@end
+
+@implementation AppDelegate
+
+@synthesize applicationState = _applicationState;
+
+#pragma mark - UIApplicationDelegate (app state changes and system events)
+
+- (BOOL)application:(UIApplication*)application
+ didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
+ self.applicationState = [[ApplicationState alloc] init];
+ self.applicationState.application = application;
+ [self configureApplicationState];
+
+ [self.applicationState launchWithOptions:launchOptions];
+ return YES;
+}
+
+- (void)applicationDidBecomeActive:(UIApplication*)application {
+}
+
+- (void)applicationWillResignActive:(UIApplication*)application {
+}
+
+- (void)applicationDidEnterBackground:(UIApplication*)application {
+}
+
+- (void)applicationWillEnterForeground:(UIApplication*)application {
+}
+
+- (void)applicationWillTerminate:(UIApplication*)application {
+}
+
+- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application {
+}
+
+#pragma mark - UIApplicationDelegate (background dowloading)
+
+- (void)application:(UIApplication*)application
+ performFetchWithCompletionHandler:
+ (void (^)(UIBackgroundFetchResult))completionHandler {
+}
+
+- (void)application:(UIApplication*)application
+ handleEventsForBackgroundURLSession:(NSString*)identifier
+ completionHandler:(void (^)())completionHandler {
+}
+
+#pragma mark - UIApplicationDelegate (user activity and quick actions)
+
+- (BOOL)application:(UIApplication*)application
+ willContinueUserActivityWithType:(NSString*)userActivityType {
+ return NO;
+}
+
+- (BOOL)application:(UIApplication*)application
+ continueUserActivity:(NSUserActivity*)userActivity
+ restorationHandler:(void (^)(NSArray*))restorationHandler {
+ return NO;
+}
+
+- (void)application:(UIApplication*)application
+ performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem
+ completionHandler:(void (^)(BOOL))completionHandler {
+}
+
+#pragma mark - UIApplicationDelegate (opening URL-specified resources)
+
+- (BOOL)application:(UIApplication*)application
+ openURL:(NSURL*)url
+ options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options {
+ [self.applicationState.URLOpener openURL:url];
+ return YES;
+}
+
+#pragma mark - Private methods
+
+// Configures the application state for application launch by setting the launch
+// steps.
+// Future architecture/refactoring note: configuring the application state in
+// this way is outside the scope of responsibility of the object as defined in
+// the header file. The correct solution is probably a helper object that can
+// perform all of the configuration necessary, and that can be adjusted as
+// needed.
+- (void)configureApplicationState {
+ [self.applicationState.launchSteps addObjectsFromArray:@[
+ [[ProviderInitializer alloc] init],
+ [[SetupBundleAndUserDefaults alloc] init],
+ [[StartChromeMain alloc] init],
+ [[SetBrowserState alloc] init],
+ [[BeginForegrounding alloc] init],
+ [[BrowserStateInitializer alloc] init],
+ [[PrepareForUI alloc] init],
+ [[CompleteForegrounding alloc] init],
+ [[TabGridCoordinator alloc] init],
+ ]];
+}
+
+@end
« no previous file with comments | « ios/chrome/app/app_delegate.h ('k') | ios/chrome/app/application_delegate/app_navigation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698