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

Side by Side Diff: remoting/ios/app/app_delegate.mm

Issue 2937733003: [CRD iOS] Branching internal and external implementations (Closed)
Patch Set: Move some initialization code to AppDelegate Created 3 years, 6 months 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #if !defined(__has_feature) || !__has_feature(objc_arc) 5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support." 6 #error "This file requires ARC support."
7 #endif 7 #endif
8 8
9 #import "remoting/ios/app/app_delegate.h" 9 #import "remoting/ios/app/app_delegate.h"
10 10
11 #include "base/i18n/icu_util.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 15
16 #import "remoting/ios/app/panel_view_controller.h"
15 #import "remoting/ios/app/remoting_view_controller.h" 17 #import "remoting/ios/app/remoting_view_controller.h"
16 #import "remoting/ios/facade/remoting_authentication.h" 18 #import "remoting/ios/facade/remoting_authentication.h"
17 #import "remoting/ios/facade/remoting_service.h" 19 #import "remoting/ios/facade/remoting_service.h"
18 20
19 @implementation AppDelegate 21 @implementation AppDelegate
20 22
21 @synthesize window = _window; 23 @synthesize window = _window;
22 24
23 - (BOOL)application:(UIApplication*)application 25 - (BOOL)application:(UIApplication*)application
24 willFinishLaunchingWithOptions:(NSDictionary*)launchOptions { 26 willFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
27 // Extra initializations needed when launching the app.
28
29 // Required to find the ICU data file, used by some file_util routines.
30 base::i18n::InitializeICU();
31
32 #ifdef DEBUG
33 // Set min log level for debug builds. For some reason this has to be
34 // negative.
35 logging::SetMinLogLevel(-1);
36 #endif
37
25 self.window = 38 self.window =
26 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 39 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
27 self.window.backgroundColor = [UIColor whiteColor]; 40 self.window.backgroundColor = [UIColor whiteColor];
28 return YES; 41 return YES;
29 } 42 }
30 43
31 - (BOOL)application:(UIApplication*)application 44 - (BOOL)application:(UIApplication*)application
32 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { 45 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
33 [self launchRemotingViewController]; 46 [self launchRemotingViewController];
34 return YES; 47 return YES;
(...skipping 11 matching lines...) Expand all
46 } 59 }
47 NSString* authorizationCode = [components objectForKey:@"code"]; 60 NSString* authorizationCode = [components objectForKey:@"code"];
48 61
49 [[RemotingService SharedInstance].authentication 62 [[RemotingService SharedInstance].authentication
50 authenticateWithAuthorizationCode:authorizationCode]; 63 authenticateWithAuthorizationCode:authorizationCode];
51 64
52 [self launchRemotingViewController]; 65 [self launchRemotingViewController];
53 return YES; 66 return YES;
54 } 67 }
55 68
69 #pragma mark - Properties
70
71 - (UIViewController<PanelViewController>*)rootViewController {
72 return (UIViewController<PanelViewController>*)self.window.rootViewController;
73 }
74
75 + (AppDelegate*)currentDelegate {
76 return (AppDelegate*)UIApplication.sharedApplication.delegate;
77 }
78
79 #pragma mark - Private
80
56 - (void)launchRemotingViewController { 81 - (void)launchRemotingViewController {
57 RemotingViewController* vc = [[RemotingViewController alloc] init]; 82 RemotingViewController* vc = [[RemotingViewController alloc] init];
58 UINavigationController* navController = 83 UINavigationController* navController =
59 [[UINavigationController alloc] initWithRootViewController:vc]; 84 [[UINavigationController alloc] initWithRootViewController:vc];
60 navController.navigationBarHidden = true; 85 navController.navigationBarHidden = true;
61 self.window.rootViewController = navController; 86 UIViewController<PanelViewController>* rootVC =
87 [PanelViewControllerFactory createController];
88 rootVC.mainViewController = navController;
89 self.window.rootViewController = rootVC;
62 [self.window makeKeyAndVisible]; 90 [self.window makeKeyAndVisible];
63 } 91 }
64 92
65 @end 93 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698