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

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

Issue 2949713002: [CRD iOS] Refactor an interface for RemotingAuthorization (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: remoting/ios/app/app_delegate.mm
diff --git a/remoting/ios/app/app_delegate.mm b/remoting/ios/app/app_delegate.mm
index 50a7597cc81d116f771850da072ba007c50ce668..3670c0c631feade007672a15e6a4034eaebca7a7 100644
--- a/remoting/ios/app/app_delegate.mm
+++ b/remoting/ios/app/app_delegate.mm
@@ -14,7 +14,7 @@
#import "remoting/ios/app/app_view_controller.h"
#import "remoting/ios/app/remoting_view_controller.h"
-#import "remoting/ios/facade/remoting_authentication.h"
+#import "remoting/ios/facade/remoting_oauth_authentication.h"
#import "remoting/ios/facade/remoting_service.h"
@interface AppDelegate () {
@@ -31,6 +31,9 @@
self.window =
[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
+ _appViewController = [[AppViewController alloc] init];
+ [[RemotingService SharedInstance]
+ setAuthentication:_appViewController.authentication];
nicholss 2017/06/21 21:31:06 This feels backwards to me. The view controller sh
Yuwei 2017/06/21 22:44:15 Done. It's now injected in the main function.
return YES;
}
@@ -41,6 +44,12 @@
}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url {
+ if (![_appViewController.authentication
nicholss 2017/06/21 21:31:06 Could it be cleaner to wrap this method in somethi
Yuwei 2017/06/21 22:44:15 Done. Use marco here. I put the DCHECK here just t
+ isKindOfClass:[RemotingOAuthAuthentication class]]) {
+ NSLog(@"OAuth authentication is not supported.");
+ return NO;
+ }
+
NSMutableDictionary* components = [[NSMutableDictionary alloc] init];
NSArray* urlComponents = [[url query] componentsSeparatedByString:@"&"];
@@ -52,7 +61,7 @@
}
NSString* authorizationCode = [components objectForKey:@"code"];
- [[RemotingService SharedInstance].authentication
+ [(RemotingOAuthAuthentication*)_appViewController.authentication
authenticateWithAuthorizationCode:authorizationCode];
[self launchRemotingViewController];
@@ -88,9 +97,7 @@
UINavigationController* navController =
[[UINavigationController alloc] initWithRootViewController:vc];
navController.navigationBarHidden = true;
-
- _appViewController =
- [[AppViewController alloc] initWithMainViewController:navController];
+ _appViewController.mainViewController = navController;
self.window.rootViewController = _appViewController;
[self.window makeKeyAndVisible];
}

Powered by Google App Engine
This is Rietveld 408576698