| OLD | NEW |
| 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/client/ios/app/app_delegate.h" | 9 #import "remoting/client/ios/app/app_delegate.h" |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 14 | 14 |
| 15 #import "remoting/client/ios/app/remoting_view_controller.h" | 15 #import "remoting/client/ios/app/remoting_view_controller.h" |
| 16 #import "remoting/client/ios/facade/remoting_authentication.h" |
| 16 #import "remoting/client/ios/facade/remoting_service.h" | 17 #import "remoting/client/ios/facade/remoting_service.h" |
| 17 | 18 |
| 18 @implementation AppDelegate | 19 @implementation AppDelegate |
| 19 | 20 |
| 20 @synthesize window = _window; | 21 @synthesize window = _window; |
| 21 | 22 |
| 22 - (BOOL)application:(UIApplication*)application | 23 - (BOOL)application:(UIApplication*)application |
| 23 willFinishLaunchingWithOptions:(NSDictionary*)launchOptions { | 24 willFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
| 24 self.window = | 25 self.window = |
| 25 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | 26 [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 NSArray* urlComponents = [[url query] componentsSeparatedByString:@"&"]; | 39 NSArray* urlComponents = [[url query] componentsSeparatedByString:@"&"]; |
| 39 | 40 |
| 40 for (NSString* componentPair in urlComponents) { | 41 for (NSString* componentPair in urlComponents) { |
| 41 NSArray* pair = [componentPair componentsSeparatedByString:@"="]; | 42 NSArray* pair = [componentPair componentsSeparatedByString:@"="]; |
| 42 NSString* key = [[pair firstObject] stringByRemovingPercentEncoding]; | 43 NSString* key = [[pair firstObject] stringByRemovingPercentEncoding]; |
| 43 NSString* value = [[pair lastObject] stringByRemovingPercentEncoding]; | 44 NSString* value = [[pair lastObject] stringByRemovingPercentEncoding]; |
| 44 [components setObject:value forKey:key]; | 45 [components setObject:value forKey:key]; |
| 45 } | 46 } |
| 46 NSString* authorizationCode = [components objectForKey:@"code"]; | 47 NSString* authorizationCode = [components objectForKey:@"code"]; |
| 47 | 48 |
| 48 [[RemotingService SharedInstance] | 49 [[RemotingService SharedInstance].authentication |
| 49 authenticateWithAuthorizationCode:authorizationCode]; | 50 authenticateWithAuthorizationCode:authorizationCode]; |
| 50 | 51 |
| 51 [self launchRemotingViewController]; | 52 [self launchRemotingViewController]; |
| 52 return YES; | 53 return YES; |
| 53 } | 54 } |
| 54 | 55 |
| 55 - (void)launchRemotingViewController { | 56 - (void)launchRemotingViewController { |
| 56 RemotingViewController* vc = [[RemotingViewController alloc] init]; | 57 RemotingViewController* vc = [[RemotingViewController alloc] init]; |
| 57 self.window.rootViewController = vc; | 58 self.window.rootViewController = vc; |
| 58 [self.window makeKeyAndVisible]; | 59 [self.window makeKeyAndVisible]; |
| 59 } | 60 } |
| 60 | 61 |
| 61 @end | 62 @end |
| OLD | NEW |